[BlackBerry] Page viewport aspect ratio not kept on navigating back
https://bugs.webkit.org/show_bug.cgi?id=99760

Reviewed by Yong Li.
Patch by Jacky Jiang <zhajiang@rim.com>.
Internally reviewed by Konrad Piascik.

PR: 222437
This is to fix the second issue on PR222437 that the viewport not kept
when navigating back from google after rotation to bloomberg.
We were trying to restore the history contents size and scale of
bloomberg which has virtual viewport. The scale would be recalculated
based on the new screen size. However, we would still use the current
contents size if it was greater than the history contents size in
FrameView::setContentsSize which made the contents seem to be scaled
too much.
Actually when we relayout the contents after rotation change, the
current contents size which is based on the virtual viewport has taken
the screen size into account. Shrinking the contents size will be
expensive. So we can ignore screen size based scale calculation here.

* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::restoreViewState):

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

* platform/chromium-linux/fast/forms/placeholder-position-expected.png:
* platform/chromium-linux/svg/zoom/page/zoom-hixie-mixed-009-expected.png:
* platform/chromium-linux/svg/zoom/page/zoom-hixie-mixed-009-expected.txt: Added.
* platform/chromium-mac-snowleopard/platform/chromium/virtual/softwarecompositing: Added.
* platform/chromium-mac-snowleopard/platform/chromium/virtual/softwarecompositing/shadows: Added.
* platform/chromium-mac-snowleopard/platform/chromium/virtual/softwarecompositing/shadows/shadow-drawing-expected.png: Added.
* platform/chromium-mac-snowleopard/svg/zoom/page/zoom-hixie-mixed-009-expected.png: Added.
* platform/chromium-mac-snowleopard/svg/zoom/page/zoom-hixie-mixed-009-expected.txt: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131924 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Rename ENABLE_CSS3_TEXT_DECORATION to ENABLE_CSS3_TEXT
https://bugs.webkit.org/show_bug.cgi?id=99804

Patch by Dongwoo Joshua Im <dw.im@samsung.com> on 2012-10-19
Reviewed by Julien Chaffraix.

CSS3 text related properties will be implemented under this flag,
including text decoration, text-align-last, and text-justify.

.:

* Source/cmake/OptionsEfl.cmake:
* Source/cmake/WebKitFeatures.cmake:
* Source/cmakeconfig.h.cmake:

Source/JavaScriptCore:

* Configurations/FeatureDefines.xcconfig:

Source/WebCore:

No new functionality, no new test.

* Configurations/FeatureDefines.xcconfig:
* GNUmakefile.am:
* GNUmakefile.features.am:
* css/CSSComputedStyleDeclaration.cpp:
(WebCore):
(WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::addTextDecorationProperty):
(WebCore::CSSParser::parseTextDecoration):
* css/CSSPrimitiveValueMappings.h:
(WebCore):
* css/CSSProperty.cpp:
(WebCore::CSSProperty::isInheritedProperty):
* css/CSSPropertyNames.in:
* css/CSSValueKeywords.in:
* css/StyleBuilder.cpp:
(WebCore::StyleBuilder::StyleBuilder):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::applyProperty):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::diff):
* rendering/style/RenderStyle.h:
* rendering/style/RenderStyleConstants.h:
(WebCore):
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):
* rendering/style/StyleRareNonInheritedData.h:
(StyleRareNonInheritedData):

Source/WebKit/chromium:

* features.gypi:

Source/WebKit/mac:

* Configurations/FeatureDefines.xcconfig:

Source/WebKit2:

* Configurations/FeatureDefines.xcconfig:

Tools:

* Scripts/webkitperl/FeatureList.pm:
* qmake/mkspecs/features/features.pri:

WebKitLibraries:

* win/tools/vsprops/FeatureDefines.vsprops:
* win/tools/vsprops/FeatureDefinesCairo.vsprops:

LayoutTests:

* platform/chromium/TestExpectations:
* platform/mac/TestExpectations:
* platform/qt-4.8/TestExpectations:
* platform/qt-mac/TestExpectations:
* platform/qt/TestExpectations:

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

* platform/chromium-mac-lion/compositing/shadows: Added.
* platform/chromium-mac-lion/compositing/shadows/shadow-drawing-expected.png: Added.
* platform/chromium-mac-lion/css2.1: Added.
* platform/chromium-mac-lion/css2.1/t0804-c5509-padn-l-03-f-g-expected.png: Added.
* platform/chromium-mac-lion/css2.1/t090501-c414-flt-03-b-g-expected.png: Added.
* platform/chromium-mac-lion/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png: Added.
* platform/chromium-mac-lion/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.txt: Added.
* platform/chromium-mac-lion/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png: Added.
* platform/chromium-mac-lion/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.txt: Added.
* platform/chromium-mac-lion/fast/block/float/032-expected.png: Added.
* platform/chromium-mac-lion/fast/forms/input-baseline-expected.png: Added.
* platform/chromium-mac-lion/fast/forms/input-placeholder-paint-order-expected.png: Added.
* platform/chromium-mac-lion/fast/forms/placeholder-position-expected.png: Added.
* platform/chromium-mac-lion/fast/forms/searchfield-heights-expected.png: Added.
* platform/chromium-mac-lion/fast/inline-block: Added.
* platform/chromium-mac-lion/fast/inline-block/contenteditable-baseline-expected.png: Added.
* platform/chromium-mac-lion/platform: Added.
* platform/chromium-mac-lion/platform/chromium: Added.
* platform/chromium-mac-lion/platform/chromium/virtual: Added.
* platform/chromium-mac-lion/platform/chromium/virtual/softwarecompositing: Added.
* platform/chromium-mac-lion/platform/chromium/virtual/softwarecompositing/shadows: Added.
* platform/chromium-mac-lion/platform/chromium/virtual/softwarecompositing/shadows/shadow-drawing-expected.png: Added.
* platform/chromium-mac-lion/tables/mozilla/bugs/bug2479-4-expected.png: Added.
* platform/chromium-mac-lion/tables/mozilla/bugs/bug30692-expected.png: Added.
* platform/chromium-mac-lion/tables/mozilla_expected_failures/bugs/bug2479-5-expected.png: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131926 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Roll DEPS

Unreviewed DEPS roll.

* DEPS:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131927 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[chromium] Implement deferred image decoding
https://bugs.webkit.org/show_bug.cgi?id=94240

Reviewed by Stephen White.

Source/WebCore:

Objectives:

To record image decoding operations during painting and to defer
decoding operations until rasterization.

Rationale:

This is a key feature that enables impl-side painting which requires
fast recording of drawing operations. The existing decode-on-draw
restricts that recording has to block on expensive decoding operations.
This change allows recording of image decoding operations during paint
time.

Design:

Image decoding happens when a BitmapImage is drawn into a
GraphicsContext. When per-tile painting is enabled GraphicsContext
is backed by SkCanvas in recording mode. This SkCanvas records drawing
and image decoding operations to minimize recording time.

An image decoding operation is recorded as a SkPixelRef object
implemented by LazyDecodingPixelRef. This object references raw encoded
data, regions to be decoded and scaling information.

When used in conjunction with per-tile painting this feature defers
image decoding until the SkCanvas referencing the image is rasterized.

Both recording and rasterization happen on the main thread.

Performance Impact:

This feature is enabled by WebKit::setDeferredImageDecodingEnabled()
and does not have an impact when disabled.

This feature is disabled by default.

Upcoming Changes:

1. Implement a full-featured image cache in ImageDecodingStore.
2. Allow rasterization and decoding on impl thread.

Classes Involved:

BitmapImage

BitmapImage is the entry point for deferred image decoding. When
drawing a BitmapImage into a GraphicsContext it makes a request to
create a NativeImageSkia. We substitute the content in NativeImageSkia
such that it is lazily decoded.

DeferredImageDecoder

This is the platform implementation of a image decoder for Chromium.
This is a bridge layer that either delegates calls to the actual
ImageDecoder or create a lazily-decoded SkBitmap and delegates calls
to ImageDecodingStore.

ImageDecodingStore

This object manages all encoded images. It keeps track of encoded
data and the corresponding ImageDecoder for doing actual decoding. It
is also responsible for generating lazily decoded SkBitmaps. This
SkBitmap contains a LazyDecodingPixelRef object which references to an
image entry in ImageDecodingStore.

ScaledImageFragment

A container for a scaled image fragment. In addition to bitmap pixels
it contains information about the ID of the image, scale and clipping.

ImageFrameGenerator

This object is responsible for generating decoded pixels. It is also
a container for encoded image data and corresponding image decoder.

LazyDecodingPixelRef

This object is embedded in a SkBitmap to enable lazy decoding. When
SkBitmap needs to access pixels LazyDecodingPixelRef is locked. It
contains information to locate an image and scaling info, these
information is submitted to ImageDecodingStore to access actual pixels.

Layout tests. There are about 80 tests in this virtual test suite
running this feature in this directory:

platform/chromium/virtual/deferred/fast/images

Unit tests. Added DeferredImageDecoderTest to verify deferred
image decoding behavior.

* WebCore.gypi:
* platform/graphics/ImageSource.cpp:
(WebCore::ImageSource::setData):
* platform/graphics/ImageSource.h:
(WebCore):
(ImageSource):
* platform/graphics/chromium/DeferredImageDecoder.cpp: Added.
(WebCore):
(WebCore::DeferredImageDecoder::DeferredImageDecoder):
(WebCore::DeferredImageDecoder::~DeferredImageDecoder):
(WebCore::DeferredImageDecoder::create):
(WebCore::DeferredImageDecoder::createForTesting):
(WebCore::DeferredImageDecoder::filenameExtension):
(WebCore::DeferredImageDecoder::frameBufferAtIndex):
(WebCore::DeferredImageDecoder::setData):
(WebCore::DeferredImageDecoder::isSizeAvailable):
(WebCore::DeferredImageDecoder::size):
(WebCore::DeferredImageDecoder::frameSizeAtIndex):
(WebCore::DeferredImageDecoder::frameCount):
(WebCore::DeferredImageDecoder::repetitionCount):
(WebCore::DeferredImageDecoder::clearFrameBufferCache):
(WebCore::DeferredImageDecoder::frameHasAlphaAtIndex):
(WebCore::DeferredImageDecoder::frameBytesAtIndex):
* platform/graphics/chromium/DeferredImageDecoder.h: Added.
(WebCore):
(DeferredImageDecoder):
* platform/graphics/chromium/ImageDecodingStore.cpp: Added.
(WebCore::ImageDecodingStore::ImageDecodingStore):
(WebCore):
(WebCore::ImageDecodingStore::~ImageDecodingStore):
(WebCore::ImageDecodingStore::instanceOnMainThread):
(WebCore::ImageDecodingStore::initializeOnMainThread):
(WebCore::ImageDecodingStore::shutdown):
(WebCore::ImageDecodingStore::isLazyDecoded):
(WebCore::ImageDecodingStore::createLazyDecodedSkBitmap):
(WebCore::ImageDecodingStore::resizeLazyDecodedSkBitmap):
(WebCore::ImageDecodingStore::setData):
(WebCore::ImageDecodingStore::lockPixels):
(WebCore::ImageDecodingStore::unlockPixels):
(WebCore::ImageDecodingStore::frameGeneratorBeingDestroyed):
(WebCore::ImageDecodingStore::calledOnValidThread):
(WebCore::ImageDecodingStore::lookupFrameCache):
(WebCore::ImageDecodingStore::deleteFrameCache):
* platform/graphics/chromium/ImageDecodingStore.h: Added.
(WebCore):
(ImageDecodingStore):
(WebCore::ImageDecodingStore::create):
* platform/graphics/chromium/ScaledImageFragment.cpp: Added.
(WebCore):
(WebCore::ScaledImageFragment::~ScaledImageFragment):
(WebCore::ScaledImageFragment::ScaledImageFragment):
(WebCore::ScaledImageFragment::isEqual):
* platform/graphics/chromium/ScaledImageFragment.h: Added.
(WebCore):
(ScaledImageFragment):
(WebCore::ScaledImageFragment::create):
(WebCore::ScaledImageFragment::bitmap):
(WebCore::ScaledImageFragment::isComplete):
* platform/graphics/chromium/ImageFrameGenerator.cpp: Added.
(WebCore):
(WebCore::ImageFrameGenerator::ImageFrameGenerator):
(WebCore::ImageFrameGenerator::~ImageFrameGenerator):
(WebCore::ImageFrameGenerator::decoder):
(WebCore::ImageFrameGenerator::setData):
* platform/graphics/chromium/ImageFrameGenerator.h: Added.
(WebCore):
(ImageFrameGenerator):
(WebCore::ImageFrameGenerator::create):
(WebCore::ImageFrameGenerator::size):
(WebCore::ImageFrameGenerator::imageId):
* platform/graphics/chromium/LazyDecodingPixelRef.cpp: Added.
(WebCore):
(WebCore::LazyDecodingPixelRef::LazyDecodingPixelRef):
(WebCore::LazyDecodingPixelRef::~LazyDecodingPixelRef):
(WebCore::LazyDecodingPixelRef::isScaled):
(WebCore::LazyDecodingPixelRef::isClipped):
(WebCore::LazyDecodingPixelRef::onLockPixels):
(WebCore::LazyDecodingPixelRef::onUnlockPixels):
(WebCore::LazyDecodingPixelRef::onLockPixelsAreWritable):
* platform/graphics/chromium/LazyDecodingPixelRef.h: Added.
(WebCore):
(LazyDecodingPixelRef):
(WebCore::LazyDecodingPixelRef::frameGenerator):
* platform/graphics/skia/NativeImageSkia.cpp:
(WebCore::NativeImageSkia::resizedBitmap):
* platform/image-decoders/ImageDecoder.h:
(ImageFrame):
(WebCore::ImageFrame::setSkBitmap):
(WebCore::ImageFrame::getSkBitmap):

Source/WebKit/chromium:

Adding new unit tests for deferred image decoding.
These tests are defined in DeferredImageDecoderTest.cpp. They verify
image decoding happens only when SkPicture is rasterized for both
scaled and non-scaled cases.

Tests: DeferredImageDecoderTest.drawIntoSkPicture
       DeferredImageDecoderTest.drawScaledIntoSkPicture

* WebKit.gypi:
* public/WebSettings.h:
* src/WebKit.cpp:
(WebKit::shutdown):
* src/WebSettingsImpl.cpp:
(WebKit::WebSettingsImpl::setDeferredImageDecodingEnabled):
(WebKit):
* src/WebSettingsImpl.h:
(WebSettingsImpl):
* tests/DeferredImageDecoderTest.cpp: Added.
(WebCore):
(DeferredImageDecoderTest):
(WebCore::DeferredImageDecoderTest::SetUp):
(WebCore::DeferredImageDecoderTest::TearDown):
(WebCore::TEST_F):
* tests/MockImageDecoder.h: Added.
(WebCore):
(MockImageDecoder):
(WebCore::MockImageDecoder::MockImageDecoder):
(WebCore::MockImageDecoder::filenameExtension):
(WebCore::MockImageDecoder::frameBufferAtIndex):
(WebCore::MockImageDecoder::frameBufferRequestCount):

Tools:

Add --enable-deferred-image-decoding to DRT.

* DumpRenderTree/chromium/DumpRenderTree.cpp:
(main):
* DumpRenderTree/chromium/TestShell.cpp:
(TestShell::TestShell):
(TestShell::resetWebSettings):
* DumpRenderTree/chromium/TestShell.h:
(TestShell::setDeferredImageDecodingEnabled):
(TestShell):
* DumpRenderTree/chromium/WebPreferences.cpp:
(WebPreferences::reset):
(WebPreferences::applyTo):
* DumpRenderTree/chromium/WebPreferences.h:
(WebPreferences):
* Scripts/webkitpy/layout_tests/port/chromium.py:
(ChromiumPort.virtual_test_suites):

LayoutTests:

Adding a virtual test suite for Chromium to test deferred image
decoding.

platform/chromium/virtual/deferred/fast/images will be tested with
--force-compositing --enable-per-tile-painting --enable-deferred-image-decoding.

* platform/chromium/virtual/deferred/fast/images/README.txt: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131928 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Maintain a list of active CSS stylesheets
https://bugs.webkit.org/show_bug.cgi?id=99843

Reviewed by Andreas Kling.

Currently we maintain a per-document list of stylesheets that matches what is returned by the StyleSheetList DOM API. 
This list contains both CSS and XSLT stylesheets which internally have basically nothing in common. Maintaining 
a list of active CSS stylesheets separately simplifies code in number of places.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::StyleResolver):
(WebCore::StyleResolver::addStylesheetsFromSeamlessParents):
(WebCore::StyleResolver::appendAuthorStyleSheets):
(WebCore::collectCSSOMWrappers):
* css/StyleResolver.h:
(StyleResolver):
* css/StyleSheetList.cpp:
(WebCore::StyleSheetList::styleSheets):
(WebCore::StyleSheetList::detachFromDocument):
* dom/Document.cpp:
(WebCore::Document::setCompatibilityMode):
* dom/DocumentStyleSheetCollection.cpp:
(WebCore::DocumentStyleSheetCollection::analyzeStyleSheetChange):
(WebCore::styleSheetsUseRemUnits):
(WebCore::filterEnabledCSSStyleSheets):
(WebCore):
(WebCore::DocumentStyleSheetCollection::updateActiveStyleSheets):
(WebCore::DocumentStyleSheetCollection::reportMemoryUsage):
* dom/DocumentStyleSheetCollection.h:
(WebCore::DocumentStyleSheetCollection::styleSheetsForStyleSheetList):
(DocumentStyleSheetCollection):
(WebCore::DocumentStyleSheetCollection::activeAuthorStyleSheets):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131929 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Chromium] Reduce memory footprint of canvas pattern object with deferred rendering
https://bugs.webkit.org/show_bug.cgi?id=99856

Patch by Justin Novosad <junov@chromium.org> on 2012-10-19
Reviewed by Stephen White.

Marking internal bitmap copy as immutable to prevent it from being
unnecessarily duplicated in skia by SkBitmapHeap.

No new tests: code path already well covered by existing layout tests
fast/canvas/canvas-pattern-*

* platform/graphics/skia/PatternSkia.cpp:
(WebCore::Pattern::platformPattern):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131930 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Don't use CStrings for message receiver names and message names
https://bugs.webkit.org/show_bug.cgi?id=99853

Reviewed by Andreas Kling.

Introduce StringReference which is similar to DataReference except it holds a pointer to + length of a char *
and can be created from a string literal. Use this in place of CString in MessageEncoder/MessageDecoder and
make MessageReceiverMap use a HashMap from StringReferences to MessageReceivers for global message receivers.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Platform/CoreIPC/Connection.cpp:
(CoreIPC::Connection::createSyncMessageEncoder):
(CoreIPC::Connection::dispatchSyncMessage):
* Platform/CoreIPC/Connection.h:
(Connection):
(CoreIPC::Connection::deprecatedSendSync):
(CoreIPC::Connection::deprecatedSend):
* Platform/CoreIPC/MessageDecoder.cpp:
(CoreIPC::MessageDecoder::MessageDecoder):
* Platform/CoreIPC/MessageDecoder.h:
(CoreIPC::MessageDecoder::messageReceiverName):
(CoreIPC::MessageDecoder::messageName):
(MessageDecoder):
* Platform/CoreIPC/MessageEncoder.cpp:
(CoreIPC::MessageEncoder::create):
(CoreIPC::MessageEncoder::MessageEncoder):
* Platform/CoreIPC/MessageEncoder.h:
(CoreIPC):
(MessageEncoder):
* Platform/CoreIPC/MessageReceiverMap.cpp:
(CoreIPC::MessageReceiverMap::addMessageReceiver):
(CoreIPC):
(CoreIPC::MessageReceiverMap::dispatchMessage):
* Platform/CoreIPC/MessageReceiverMap.h:
(MessageReceiverMap):
* Platform/CoreIPC/StringReference.cpp: Added.
(CoreIPC):
(CoreIPC::StringReference::encode):
(CoreIPC::StringReference::decode):
(CoreIPC::StringReference::Hash::hash):
* Platform/CoreIPC/StringReference.h: Added.
(CoreIPC):
(StringReference):
(CoreIPC::StringReference::StringReference):
(CoreIPC::StringReference::isEmpty):
(CoreIPC::StringReference::size):
(CoreIPC::StringReference::data):
(CoreIPC::StringReference::operator==):
(Hash):
(CoreIPC::StringReference::Hash::equal):
(WTF):
* Platform/CoreIPC/mac/ConnectionMac.cpp:
(CoreIPC::Connection::open):
* Scripts/webkit2/messages.py:
(message_to_struct_declaration):
(forward_declarations_and_headers):
(generate_messages_header):
* Scripts/webkit2/messages_unittest.py:
* Shared/CoreIPCSupport/WebContextMessageKinds.h:
* Target.pri:
* UIProcess/WebContext.cpp:
(WebKit::WebContext::WebContext):
(WebKit::WebContext::addMessageReceiver):
(WebKit):
* UIProcess/WebContext.h:
(WebContext):
* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::deprecatedSend):
(WebKit::WebProcessProxy::send):
* WebKit2.xcodeproj/project.pbxproj:
* win/WebKit2.vcproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131931 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION(r131822): It made 500+ tests crash on 32 bit platforms
https://bugs.webkit.org/show_bug.cgi?id=99814

Reviewed by Filip Pizlo.

Call the correct macro in 32bit.

* llint/LowLevelInterpreter.asm:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131932 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Shader translator needs option to clamp uniform array accesses in vertex shaders
https://bugs.webkit.org/show_bug.cgi?id=98977
https://code.google.com/p/angleproject/issues/detail?id=49

Reviewed by Alok Priyadarshi and Ken Russell.

Source/ThirdParty/ANGLE:

WebGL does not allow GLSL code to index a uniform array outside its bounds. Add a
flag to the ANGLE compiler to insert clamp statements around such indexing.
Since it is possible to access vec2/3/4 and mat2/3/4 components by array indexing,
they must be similarly clamped.

Unfortunately, it is currently not possible to always determine that the indexing is
operating on a uniform variable. For example, suppose we have "uniform mat4 a". ANGLE
is currently not able to tell us that the rvalue of "a[0]" is a uniform, just that
it has a size of 4. Therefore, the clamping is done on all indirect array indexing.

This will have a performance impact. Future enhancements may be able to determine
cases where the clamping is not necessary. Currently only direct indexing is skipped
(i.e. looking up a value using a constant index).

The clamp insertion is only performed on the GLSL output. Direct3D already guarantees
that out-of-bounds uniform array access returns a zero value.

* ANGLE.xcodeproj/project.pbxproj:
* Target.pri:
* include/GLSLANG/ShaderLang.h: New compiler option.
* src/compiler/ArrayBoundsClamper.cpp: Added.
(ArrayBoundsClamper::ArrayBoundsClamper):
(ArrayBoundsClamper::OutputClampingFunctionDefinition): Injects a clamping function for integers into GLSL source.
(ArrayBoundsClamper::MarkIndirectArrayBoundsForClamping): Examines the AST looking for non-direct array indexing.
* src/compiler/ArrayBoundsClamper.h: Added.
(ArrayBoundsClamper):
(ArrayBoundsClamper::GetArrayBoundsClampDefinitionNeeded):
(ArrayBoundsClamper::SetArrayBoundsClampDefinitionNeeded): Marks the object as needing to output the clamping function.
(ArrayBoundsClamper::Cleanup): Resets the state so that subsequent runs start fresh.
* src/compiler/Compiler.cpp:
(TCompiler::compile): Run the clamping code if the compile option was set.
(TCompiler::clearResults):
(TCompiler::getArrayBoundsClamper):
* src/compiler/OutputGLSLBase.cpp:
(TOutputGLSLBase::visitBinary): If the expression has been flagged, insert an appropriate "clamp" statement.
* src/compiler/ShHandle.h:
(TCompiler):
* src/compiler/TranslatorESSL.cpp:
(TranslatorESSL::translate):
* src/compiler/TranslatorGLSL.cpp:
(TranslatorGLSL::translate):
* src/compiler/intermOut.cpp:
(TType::getCompleteString): Add array size to intermediate tree output.
* src/compiler/intermediate.h:
(TIntermBinary::setAddIndexClamp): New flag for indicating a binary expression needs clamping.
(TIntermBinary::getAddIndexClamp):
(TIntermBinary):

Source/WebCore:

WebGL forbids out-of-bounds array access in shaders. Rewrite any shaders to
ensure that non-direct array indexing is clamped to the bounds of the array.

Test: fast/canvas/webgl/array-bounds-clamping.html

* platform/graphics/ANGLEWebKitBridge.cpp:
(WebCore::ANGLEWebKitBridge::compileShaderSource): Pass new compiler option SH_CLAMP_INDIRECT_ARRAY_BOUNDS

LayoutTests:

* fast/canvas/webgl/array-bounds-clamping-expected.txt: Added.
* fast/canvas/webgl/array-bounds-clamping.html: Added.
* platform/chromium/TestExpectations: Won't pass on Chromium until this patch is upstreamed.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131933 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[V8] IndexedDB: Crash when lazy-indexing Date keys
https://bugs.webkit.org/show_bug.cgi?id=99860

Reviewed by Adam Barth.

Source/WebCore:

Missing a scope/context needed when digging values out of Date objects
in an indexing callback.

Test: storage/indexeddb/lazy-index-types.html

* bindings/v8/IDBBindingUtilities.cpp:
(WebCore::createIDBKeyFromScriptValueAndKeyPath):

LayoutTests:

Add test for greedy/lazy indexing all different key types.

* storage/indexeddb/lazy-index-types-expected.txt: Added.
* storage/indexeddb/lazy-index-types.html: Added.
* storage/indexeddb/resources/lazy-index-types.js: Added.
(test.request.onsuccess):
(test):
(onSuccess.request.onsuccess):
(onSuccess):
(onComplete):


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

* platform/chromium-linux/svg/zoom/page/zoom-hixie-mixed-009-expected.txt: Removed.
* platform/chromium-mac-lion/svg/zoom/page/zoom-hixie-mixed-009-expected.png: Added.
* platform/chromium-mac-lion/svg/zoom/page/zoom-hixie-mixed-009-expected.txt: Added.
* platform/chromium-mac-snowleopard/svg/zoom/page/zoom-hixie-mixed-009-expected.png: Removed.
* platform/chromium-mac-snowleopard/svg/zoom/page/zoom-hixie-mixed-009-expected.txt: Removed.
* platform/chromium-win-xp/svg/zoom/page/zoom-hixie-mixed-009-expected.png: Removed.
* platform/chromium-win/svg/zoom/page/zoom-hixie-mixed-009-expected.png:
* platform/chromium-win/svg/zoom/page/zoom-hixie-mixed-009-expected.txt:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131935 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: merge "docked" state into the "dock side" enum.
https://bugs.webkit.org/show_bug.cgi?id=99717

Reviewed by Vsevolod Vlasov.

Source/WebCore:

Otherwise, it is hard to manage these inter-dependent flags.

* inspector/InspectorFrontendClient.h:
(InspectorFrontendClient):
* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::requestSetDockSide):
(WebCore::InspectorFrontendClientLocal::setAttachedWindow):
* inspector/InspectorFrontendClientLocal.h:
(InspectorFrontendClientLocal):
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::requestSetDockSide):
* inspector/InspectorFrontendHost.h:
(InspectorFrontendHost):
* inspector/InspectorFrontendHost.idl:
* inspector/front-end/DockController.js:
(WebInspector.DockController):
(WebInspector.DockController.prototype._updateUI.get sides):
(WebInspector.DockController.prototype._updateUI):
(WebInspector.DockController.prototype._toggleDockState):
* inspector/front-end/InspectorFrontendAPI.js:
(InspectorFrontendAPI.setAttachedWindow):
* inspector/front-end/InspectorFrontendHostStub.js:
(.WebInspector.InspectorFrontendHostStub.prototype.requestSetDockSide):

Source/WebKit/chromium:

* public/WebDevToolsFrontendClient.h:
* src/InspectorFrontendClientImpl.cpp:
(WebKit::InspectorFrontendClientImpl::requestSetDockSide):
* src/InspectorFrontendClientImpl.h:
(InspectorFrontendClientImpl):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131936 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[BlackBerry] Move all keyboard type calculations into InputHandler.
https://bugs.webkit.org/show_bug.cgi?id=99847

Reviewed by Yong Li.

PR 227381.

Move all keyboard type calculations into webkit and avoid passing type
information to the webview.

Reviewed Internally by Nima Ghanavatian.

* Api/WebPageClient.h:
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::convertInputTypeToVKBType):
(WebKit):
(BlackBerry::WebKit::InputHandler::setElementFocused):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131937 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Added WTF::StackStats mechanism.
https://bugs.webkit.org/show_bug.cgi?id=99805.

Reviewed by Geoffrey Garen.

Source/JavaScriptCore: 

Added StackStats checkpoints and probes.

* bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::emitNode):
(JSC::BytecodeGenerator::emitNodeInConditionContext):
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::append):
(JSC::visitChildren):
(JSC::SlotVisitor::donateKnownParallel):
(JSC::SlotVisitor::drain):
(JSC::SlotVisitor::drainFromShared):
(JSC::SlotVisitor::mergeOpaqueRoots):
(JSC::SlotVisitor::internalAppend):
(JSC::SlotVisitor::harvestWeakReferences):
(JSC::SlotVisitor::finalizeUnconditionalFinalizers):
* interpreter/Interpreter.cpp:
(JSC::Interpreter::execute):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::prepareForRepeatCall):
* parser/Parser.h:
(JSC::Parser::canRecurse):
* runtime/StringRecursionChecker.h:
(StringRecursionChecker):

Source/WebCore: 

Added StackStats probes in layout methods.

* dom/Document.cpp:
(WebCore::Document::updateLayout):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::layout):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::layout):
* rendering/RenderDialog.cpp:
(WebCore::RenderDialog::layout):
* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::layout):
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::layout):
* rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::layout):
* rendering/RenderIFrame.cpp:
(WebCore::RenderIFrame::layout):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::layout):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::layout):
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::layout):
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::layout):
* rendering/RenderMedia.cpp:
(WebCore::RenderMedia::layout):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::layout):
* rendering/RenderObject.h:
* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::layout):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::layout):
* rendering/RenderReplica.cpp:
(WebCore::RenderReplica::layout):
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::layoutSpecialExcludedChild):
* rendering/RenderScrollbarPart.cpp:
(WebCore::RenderScrollbarPart::layout):
* rendering/RenderSlider.cpp:
(WebCore::RenderSlider::layout):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::layout):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::layout):
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::layout):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::layout):
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::layout):
* rendering/RenderTextTrackCue.cpp:
(WebCore::RenderTextTrackCue::layout):
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::layout):
* rendering/RenderView.cpp:
(WebCore::RenderView::layout):
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::layout):
* rendering/svg/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::layout):
* rendering/svg/RenderSVGForeignObject.cpp:
(WebCore::RenderSVGForeignObject::layout):
* rendering/svg/RenderSVGGradientStop.cpp:
(WebCore::RenderSVGGradientStop::layout):
* rendering/svg/RenderSVGHiddenContainer.cpp:
(WebCore::RenderSVGHiddenContainer::layout):
* rendering/svg/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::layout):
* rendering/svg/RenderSVGResourceContainer.cpp:
(WebCore::RenderSVGResourceContainer::layout):
* rendering/svg/RenderSVGResourceMarker.cpp:
(WebCore::RenderSVGResourceMarker::layout):
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::layout):
* rendering/svg/RenderSVGShape.cpp:
(WebCore::RenderSVGShape::layout):
* rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::layout):

Source/WTF: 

Disabled by default. Should have no performance and memory cost when
disabled. To enable, #define ENABLE_STACK_STATS 1 in StackStats.h.
The output is currently hardcoded to be dumped in /tmp/stack-stats.log,
and is in the form of stack sample events. By default, it only logs
a sample event when a new high watermark value is encountered.

Also renamed StackBounds::recursiveCheck() to isSafeToRecurse().

* WTF.xcodeproj/project.pbxproj:
* wtf/StackBounds.h:
(StackBounds):
(WTF::StackBounds::size):
(WTF::StackBounds::isSafeToRecurse):
* wtf/StackStats.cpp: Added.
(WTF):
(WTF::StackStats::initialize):
(WTF::StackStats::PerThreadStats::PerThreadStats):
(WTF::StackStats::CheckPoint::CheckPoint):
(WTF::StackStats::CheckPoint::~CheckPoint):
(WTF::StackStats::probe):
(WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
(WTF::StackStats::LayoutCheckPoint::~LayoutCheckPoint):
* wtf/StackStats.h: Added.
(WTF):
(StackStats):
(CheckPoint):
(WTF::StackStats::CheckPoint::CheckPoint):
(PerThreadStats):
(WTF::StackStats::PerThreadStats::PerThreadStats):
(LayoutCheckPoint):
(WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
(WTF::StackStats::initialize):
(WTF::StackStats::probe):
* wtf/ThreadingPthreads.cpp:
(WTF::initializeThreading):
* wtf/WTFThreadData.cpp:
(WTF::WTFThreadData::WTFThreadData):
* wtf/WTFThreadData.h:
(WTFThreadData):
(WTF::WTFThreadData::stackStats):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131938 268f45cc-cd09-0410-ab3c-d52691b4dbfc
https://bugs.webkit.org/show_bug.cgi?id=99768
We should limit the tile cache coverage when a page can't take 
advantage of fast tile scrolling anyway

Reviewed by Simon Fraser.

When sites can't use fast-scrolling, there is no need to inflate the 
tile cache. In fact, we get a performance boost by keeping it small 
on painting-intensive sites. 

Instead of just looking a whether or not the FrameView 
canHaveScrollbar(), consult 
shouldUpdateScrollLayerPositionOnMainThread().
* page/FrameView.cpp:
(WebCore::FrameView::performPostLayoutTasks):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::RenderLayerBacking):
        
Expose shouldUpdateScrollLayerPositionOnMainThread().
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::hasNonLayerFixedObjects):
(WebCore::ScrollingCoordinator::shouldUpdateScrollLayerPositionOnMainThread):
(WebCore):
(WebCore::ScrollingCoordinator::updateShouldUpdateScrollLayerPositionOnMainThread):
* page/scrolling/ScrollingCoordinator.h:
(ScrollingCoordinator):

Bug fix. Should be bitwise and.
* platform/graphics/ca/mac/TileCache.mm:
(WebCore::TileCache::tileCoverageRect):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131939 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Use tile caches in place of CATiledLayer
https://bugs.webkit.org/show_bug.cgi?id=99806
<rdar://problem/6474145>

Reviewed by Tim Horton.

Have GraphicsLayerCA use TileCaches instead of CATiledLayer now for
layers that exceed the 2000px size threshold.

* platform/graphics/TiledBacking.h:
(TiledBacking): Have normal getter and setter for the visible rect.
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::flushCompositingStateForThisLayerOnly): We need
to pass in an old visibleRect to commitLayerChangesBeforeSublayers(). Just use
our current visible rect, which result in no tile area work.
(WebCore::GraphicsLayerCA::computeVisibleRect): Make this const and have it
return the rect, for clarity.
(WebCore::GraphicsLayerCA::recursiveCommitChanges): Keep track of the old
visible rect, and use the change flags mechanism to ensure that we recompute
tile areas later.
When calling commitLayerChangesBeforeSublayers() on the mask layer, just pass
its own visible rect as the old visible rect.
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): Pass in the
oldVisibleRect so that updateVisibleRect() can use this to see how the
visibleRect is changing.
(WebCore::GraphicsLayerCA::adjustTiledLayerVisibleRect): This member function
compares the old and new visible rects, and extends the tile coverage area
in directions where more content is being exposed. It takes care to avoid
"jitter" in the visible rect deltas causing edge tiles to get created then
destroyed by keeping any extra padding that already exists in a direction
where more content is being exposed.
(WebCore::GraphicsLayerCA::updateVisibleRect): Call adjustTiledLayerVisibleRect()
and use the result to update the TiledBacking's visibleRect.
(WebCore::GraphicsLayerCA::swapFromOrToTiledLayer): Create layers of type
LayerTypeTileCacheLayer instead of LayerTypeWebTiledLayer. Because tile
cache layers involve adding an extra layer to the hierarchy (the tile container),
we call updateSublayerList() when changing layer type.
* platform/graphics/ca/GraphicsLayerCA.h: New m_sizeAtLastVisibleRectUpdate member
that is used to prevent the adjustTiledLayerVisibleRect() logic being confused by
size changes.
(WebCore::GraphicsLayerCA::visibleRect):
* platform/graphics/ca/mac/TileCache.h: Have normal getter and setter for the visible rect.
* platform/graphics/ca/mac/TileCache.mm:
(WebCore::TileCache::setVisibleRect): Renamed to setVisibleRect().
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::flushPendingLayerChanges): Avoid doing work
for pages in the page cache, for which the root layer is unattached.
(WebCore::RenderLayerCompositor::frameViewDidScroll): visibleRectChanged() was renamed
to setVisibleRect().

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Cairo][WTR] Implement the painting of repaint rectangles.
https://bugs.webkit.org/show_bug.cgi?id=99839

Reviewed by Martin Robinson.

Implement the required code to paint the gray overlay with
transparent regions for the repaint rectangles, as other ports
already do and as is already done in most WK1 ports.

* WebKitTestRunner/cairo/TestInvocationCairo.cpp:
(WTR::paintRepaintRectOverlay):
(WTR::TestInvocation::dumpPixelsAndCompareWithExpected):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131941 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (r130699): 5 various fast/ tests started failing
https://bugs.webkit.org/show_bug.cgi?id=98729

Reviewed by Xan Lopez.

Source/WebCore:

Do not try to remove the URL fragment for data URLs. This will likely
just corrupt the URL.

No new tests. This unskips some previously failing tests.

* platform/network/soup/ResourceRequestSoup.cpp:
(WebCore::ResourceRequest::urlStringForSoup): Do nothing for data URLs.

LayoutTests:

Unskip some tests which are now passing.

* platform/gtk/TestExpectations:

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