diff options
26 files changed, 164 insertions, 149 deletions
diff --git a/ThirdPartyProject.prop b/ThirdPartyProject.prop index 87b7885..4efb8e4 100644 --- a/ThirdPartyProject.prop +++ b/ThirdPartyProject.prop @@ -11,4 +11,4 @@ homepage=http\://webkit.org/ # Currently we track the Chromium 9.0.597 release branch: # http://trac.webkit.org/browser/branches/chromium/597 # which is WebKit r72805 + stability cherry picks. -webkit.chromiumRelease=http\://src.chromium.org/svn/releases/9.0.597.76/DEPS +webkit.chromiumRelease=http\://src.chromium.org/svn/releases/9.0.597.83/DEPS diff --git a/WebCore/Android.mk b/WebCore/Android.mk index 4428a84..7861bd3 100644 --- a/WebCore/Android.mk +++ b/WebCore/Android.mk @@ -615,7 +615,6 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \ platform/graphics/android/ImageBufferAndroid.cpp \ platform/graphics/android/ImageSourceAndroid.cpp \ platform/graphics/android/LayerAndroid.cpp \ - platform/graphics/android/LayerTexture.cpp \ platform/graphics/android/MediaLayer.cpp \ platform/graphics/android/PaintLayerOperation.cpp \ platform/graphics/android/PathAndroid.cpp \ diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index b56a885..ae5f73f 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,18 @@ +2011-01-20 Xiaomei Ji <xji@chromium.org> + + Reviewed by Dan Bernstein. + + Fix regression(r71566): PDF in RTL block might messes up text directionality. + https://bugs.webkit.org/show_bug.cgi?id=52776 + + Test: fast/dom/52776.html + + * platform/text/BidiResolver.h: + (WebCore::::checkDirectionInLowerRaiseEmbeddingLevel): + (WebCore::::lowerExplicitEmbeddingLevel): + (WebCore::::raiseExplicitEmbeddingLevel): + (WebCore::::createBidiRunsForLine): + 2011-01-12 Kenichi Ishibashi <bashi@google.com> Reviewed by Kent Tamura. diff --git a/WebCore/bindings/v8/V8GCController.cpp b/WebCore/bindings/v8/V8GCController.cpp index 3eeacec..9107b51 100644 --- a/WebCore/bindings/v8/V8GCController.cpp +++ b/WebCore/bindings/v8/V8GCController.cpp @@ -453,8 +453,7 @@ void V8GCController::checkMemoryUsage() // Query the PlatformBridge for memory thresholds as these vary device to device. static const int lowUsageMB = PlatformBridge::lowMemoryUsageMB(); static const int highUsageMB = PlatformBridge::highMemoryUsageMB(); - // We use a delta of -1 to ensure that when we are in a low memory situation we always trigger a GC. - static const int highUsageDeltaMB = -1; + static const int highUsageDeltaMB = PlatformBridge::highUsageDeltaMB(); #else return; #endif diff --git a/WebCore/platform/android/PlatformBridge.h b/WebCore/platform/android/PlatformBridge.h index c67c865..7d54ae5 100644 --- a/WebCore/platform/android/PlatformBridge.h +++ b/WebCore/platform/android/PlatformBridge.h @@ -145,6 +145,7 @@ public: // Memory details for V8 GC static int lowMemoryUsageMB(); static int highMemoryUsageMB(); + static int highUsageDeltaMB(); static int memoryUsageMB(); static int actualMemoryUsageMB(); }; diff --git a/WebCore/platform/graphics/android/GLUtils.cpp b/WebCore/platform/graphics/android/GLUtils.cpp index 7a8fd26..b62072b 100644 --- a/WebCore/platform/graphics/android/GLUtils.cpp +++ b/WebCore/platform/graphics/android/GLUtils.cpp @@ -316,6 +316,16 @@ void GLUtils::createTextureWithBitmap(GLuint texture, SkBitmap& bitmap, GLint fi } glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter); + + // The following is a workaround -- remove when EGLImage texture upload is fixed. + GLuint fboID; + glGenFramebuffers(1, &fboID); + glBindFramebuffer(GL_FRAMEBUFFER, fboID); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0); + glCheckFramebufferStatus(GL_FRAMEBUFFER); // should return GL_FRAMEBUFFER_COMPLETE + + glBindFramebuffer(GL_FRAMEBUFFER, 0); // rebind the standard FBO + glDeleteFramebuffers(1, &fboID); } void GLUtils::updateTextureWithBitmap(GLuint texture, SkBitmap& bitmap, GLint filter) diff --git a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp index 46be9bb..ab0e0ea 100644 --- a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp +++ b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp @@ -200,17 +200,23 @@ bool GraphicsLayerAndroid::replaceChild(GraphicsLayer* oldChild, GraphicsLayer* { LOG("(%x) replaceChild %x by %x", this, oldChild, newChild); bool ret = GraphicsLayer::replaceChild(oldChild, newChild); - m_needsSyncChildren = true; - askForSync(); + if (ret) { + m_needsSyncChildren = true; + askForSync(); + } return ret; } void GraphicsLayerAndroid::removeFromParent() { LOG("(%x) removeFromParent()", this); + GraphicsLayerAndroid* parent = static_cast<GraphicsLayerAndroid*>(m_parent); GraphicsLayer::removeFromParent(); - m_needsSyncChildren = true; - askForSync(); + // Update the parent's children. + if (parent) { + parent->m_needsSyncChildren = true; + askForSync(); + } } void GraphicsLayerAndroid::updateFixedPosition() @@ -251,10 +257,11 @@ void GraphicsLayerAndroid::updateFixedPosition() SkRect viewRect; viewRect.set(paintingOffsetX, paintingOffsetY, paintingOffsetX + w, paintingOffsetY + h); - + IntPoint renderLayerPos(renderLayer->x(), renderLayer->y()); m_contentLayer->setFixedPosition(left, top, right, bottom, marginLeft, marginTop, marginRight, marginBottom, + renderLayerPos, viewRect); } } diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp index 2fd3790..03bb11d 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -101,7 +101,7 @@ LayerAndroid::LayerAndroid(const LayerAndroid& layer) : SkLayer(layer), m_isFixed = layer.m_isFixed; m_contentsImage = layer.m_contentsImage; m_contentsImage->safeRef(); - + m_renderLayerPos = layer.m_renderLayerPos; m_transform = layer.m_transform; m_backgroundColor = layer.m_backgroundColor; @@ -225,8 +225,9 @@ bool LayerAndroid::evaluateAnimations(double time) const return hasRunningAnimations; } -void LayerAndroid::addAnimation(PassRefPtr<AndroidAnimation> anim) +void LayerAndroid::addAnimation(PassRefPtr<AndroidAnimation> prpAnim) { + RefPtr<AndroidAnimation> anim = prpAnim; if (m_animations.get(anim->name())) removeAnimation(anim->name()); m_animations.add(anim->name(), anim); @@ -461,17 +462,20 @@ void LayerAndroid::updateFixedLayersPositions(const SkRect& viewport) float x = dx; float y = dy; - // Not defined corresponds to 'auto'; - // If both left and right are auto, the w3c says we should set left - // to zero (in left-to-right layout). So we use left if it's defined - // or if right isn't defined. + // It turns out that when it is 'auto', the webkit computation will + // take one more factor into account, that is the original render + // layer's X,Y, such that it will align well with the parent's layer. + if (!(m_fixedLeft.defined() || m_fixedRight.defined())) + x += m_renderLayerPos.x(); + + if (!(m_fixedTop.defined() || m_fixedBottom.defined())) + y += m_renderLayerPos.y(); + if (m_fixedLeft.defined() || !m_fixedRight.defined()) x += m_fixedMarginLeft.calcFloatValue(w) + m_fixedLeft.calcFloatValue(w) - m_fixedRect.fLeft; else x += w - m_fixedMarginRight.calcFloatValue(w) - m_fixedRight.calcFloatValue(w) - m_fixedRect.fRight; - // Following the same reason as above, if bottom isn't defined, we apply - // top regardless of it being defined or not. if (m_fixedTop.defined() || !m_fixedBottom.defined()) y += m_fixedMarginTop.calcFloatValue(h) + m_fixedTop.calcFloatValue(h) - m_fixedRect.fTop; else @@ -632,8 +636,7 @@ void LayerAndroid::createGLTextures() m_atomicSync.unlock(); if (reservedTexture && - (reservedTexture != m_drawingTexture) && - reservedTexture->isReady()) { + (reservedTexture != m_drawingTexture)) { if (m_drawingTexture) { TilesManager::instance()->removeOperationsForTexture(m_drawingTexture); m_drawingTexture->release(this); @@ -648,8 +651,8 @@ void LayerAndroid::createGLTextures() if (!m_requestSent) { m_requestSent = true; m_atomicSync.unlock(); - XLOG("We schedule a paint for layer %d (%x), because isReady %d or m_dirty %d, using texture %x (%d, %d)", - uniqueId(), this, m_reservedTexture->isReady(), m_dirty, m_reservedTexture, + XLOG("We schedule a paint for layer %d (%x), because m_dirty %d, using texture %x (%d, %d)", + uniqueId(), this, m_dirty, m_reservedTexture, m_reservedTexture->rect().width(), m_reservedTexture->rect().height()); PaintLayerOperation* operation = new PaintLayerOperation(this); TilesManager::instance()->scheduleOperation(operation); @@ -665,18 +668,16 @@ bool LayerAndroid::needsScheduleRepaint(LayerTexture* texture) if (!texture) return false; - if (!m_pictureUsed == -1 || texture->pictureUsed() != m_pictureUsed) { + if (m_pictureUsed == -1 || + texture->pictureUsed() == -1 || + texture->pictureUsed() != m_pictureUsed) { XLOG("We mark layer %d (%x) as dirty because: m_pictureUsed(%d == 0?), texture picture used %x", uniqueId(), this, m_pictureUsed, texture->pictureUsed()); if (m_pictureUsed == -1) m_pictureUsed = 0; - texture->setPictureUsed(m_pictureUsed); m_dirty = true; } - if (!texture->isReady()) - m_dirty = true; - return m_dirty; } @@ -697,7 +698,7 @@ bool LayerAndroid::drawGL(SkMatrix& matrix) if (prepareContext() && m_drawingTexture) { TextureInfo* textureInfo = m_drawingTexture->consumerLock(); - if (textureInfo && m_drawingTexture->isReady()) { + if (textureInfo) { SkRect bounds; IntRect textureRect = m_drawingTexture->rect(); bounds.set(0, 0, textureRect.width(), textureRect.height()); @@ -801,18 +802,15 @@ void LayerAndroid::paintBitmapGL() contentDraw(canvas); canvas->restore(); - XLOG("LayerAndroid %d paintBitmapGL PAINTING DONE, updating the texture", uniqueId()); - texture->producerUpdate(textureInfo); - - while (!texture->isReady()) { - TextureInfo* textureInfo = texture->producerLock(); - texture->producerUpdate(textureInfo); - } - m_atomicSync.lock(); m_dirty = false; m_requestSent = false; + texture->setPictureUsed(m_pictureUsed); m_atomicSync.unlock(); + + XLOG("LayerAndroid %d paintBitmapGL PAINTING DONE, updating the texture", uniqueId()); + texture->producerUpdate(textureInfo); + XLOG("LayerAndroid %d paintBitmapGL UPDATING DONE", uniqueId()); } diff --git a/WebCore/platform/graphics/android/LayerAndroid.h b/WebCore/platform/graphics/android/LayerAndroid.h index 72eba0f..bb91755 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.h +++ b/WebCore/platform/graphics/android/LayerAndroid.h @@ -138,6 +138,7 @@ public: SkLength marginTop, // CSS margin-top property SkLength marginRight, // CSS margin-right property SkLength marginBottom, // CSS margin-bottom property + const IntPoint& renderLayerPos, // For undefined fixed position SkRect viewRect) { // view rect, can be smaller than the layer's m_fixedLeft = left; m_fixedTop = top; @@ -149,6 +150,7 @@ public: m_fixedMarginBottom = marginBottom; m_fixedRect = viewRect; m_isFixed = true; + m_renderLayerPos = renderLayerPos; setInheritFromRootTransform(true); } @@ -259,6 +261,10 @@ private: SkLength m_fixedMarginBottom; SkRect m_fixedRect; + // When fixed element is undefined or auto, the render layer's position + // is needed for offset computation + IntPoint m_renderLayerPos; + TransformationMatrix m_transform; SkColor m_backgroundColor; diff --git a/WebCore/platform/graphics/android/LayerTexture.cpp b/WebCore/platform/graphics/android/LayerTexture.cpp deleted file mode 100644 index 294c3d3..0000000 --- a/WebCore/platform/graphics/android/LayerTexture.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2010, The Android Open Source Project - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "LayerTexture.h" - -#define DOUBLE_BUFFERED_TEXTURE_MINIMUM_ACCESS 3 - -void LayerTexture::producerUpdate(TextureInfo* textureInfo) -{ - update(); - BackedDoubleBufferedTexture::producerUpdate(textureInfo); -} - -void LayerTexture::update() -{ - // FIXME: fix the double buffered texture class instead of doing this - // this is a stop gap measure and should be removed. - // Right now we have to update the textures 3 times (one create, two - // updates) before we can be sure to have a non-corrupted texture - // to display. - if (m_textureUpdates < DOUBLE_BUFFERED_TEXTURE_MINIMUM_ACCESS) - m_textureUpdates++; -} - -bool LayerTexture::isReady() -{ - return m_textureUpdates == DOUBLE_BUFFERED_TEXTURE_MINIMUM_ACCESS; -} diff --git a/WebCore/platform/graphics/android/LayerTexture.h b/WebCore/platform/graphics/android/LayerTexture.h index 3654476..fb1b9fb 100644 --- a/WebCore/platform/graphics/android/LayerTexture.h +++ b/WebCore/platform/graphics/android/LayerTexture.h @@ -38,8 +38,7 @@ class LayerTexture : public BackedDoubleBufferedTexture { : BackedDoubleBufferedTexture(w, h, config) , m_id(0) , m_scale(1) - , m_pictureUsed(0) - , m_textureUpdates(0) + , m_pictureUsed(-1) {} virtual ~LayerTexture() {}; @@ -48,21 +47,17 @@ class LayerTexture : public BackedDoubleBufferedTexture { unsigned int pictureUsed() { return m_pictureUsed; } void setPictureUsed(unsigned pictureUsed) { m_pictureUsed = pictureUsed; } - bool isReady(); - virtual void producerUpdate(TextureInfo* textureInfo); void setRect(const IntRect& r) { m_rect = r; } IntRect& rect() { return m_rect; } float scale() { return m_scale; } void setScale(float scale) { m_scale = scale; } private: - void update(); int m_id; IntRect m_rect; float m_scale; unsigned int m_pictureUsed; - unsigned int m_textureUpdates; }; } // namespace WebCore diff --git a/WebCore/platform/graphics/android/MediaLayer.cpp b/WebCore/platform/graphics/android/MediaLayer.cpp index 9c370a5..e4ccbdb 100644 --- a/WebCore/platform/graphics/android/MediaLayer.cpp +++ b/WebCore/platform/graphics/android/MediaLayer.cpp @@ -46,6 +46,7 @@ MediaLayer::MediaLayer() : LayerAndroid(false) m_bufferedTexture = new MediaTexture(EGL_NO_CONTEXT); m_bufferedTexture->incStrong(this); m_currentTextureInfo = 0; + m_isContentInverted = false; XLOG("Creating Media Layer %p", this); } @@ -54,6 +55,7 @@ MediaLayer::MediaLayer(const MediaLayer& layer) : LayerAndroid(layer) m_bufferedTexture = layer.getTexture(); m_bufferedTexture->incStrong(this); m_currentTextureInfo = 0; + m_isContentInverted = layer.m_isContentInverted; XLOG("Creating Media Layer Copy %p -> %p", &layer, this); } @@ -71,6 +73,14 @@ bool MediaLayer::drawGL(SkMatrix& matrix) SkRect rect; rect.set(0, 0, getSize().width(), getSize().height()); TransformationMatrix m = drawTransform(); + + // the layer's shader draws the content inverted so we must undo + // that change in the transformation matrix + if (!m_isContentInverted) { + m.flipY(); + m.translate(0, -getSize().height()); + } + TilesManager::instance()->shader()->drawLayerQuad(m, rect, textureInfo->m_textureId, 1.0f); //TODO fix this m_drawOpacity diff --git a/WebCore/platform/graphics/android/MediaLayer.h b/WebCore/platform/graphics/android/MediaLayer.h index eb56440..1944512 100644 --- a/WebCore/platform/graphics/android/MediaLayer.h +++ b/WebCore/platform/graphics/android/MediaLayer.h @@ -54,6 +54,7 @@ public: void setCurrentTextureInfo(TextureInfo* info) { m_currentTextureInfo = info; } TextureInfo* getCurrentTextureInfo() const { return m_currentTextureInfo; } + void invertContents(bool invertContent) { m_isContentInverted = invertContent; } private: @@ -62,6 +63,7 @@ private: TextureInfo* m_currentTextureInfo; + bool m_isContentInverted; }; } // namespace WebCore diff --git a/WebCore/platform/text/BidiResolver.h b/WebCore/platform/text/BidiResolver.h index 1f87115..6018c3f 100644 --- a/WebCore/platform/text/BidiResolver.h +++ b/WebCore/platform/text/BidiResolver.h @@ -314,23 +314,13 @@ void BidiResolver<Iterator, Run>::checkDirectionInLowerRaiseEmbeddingLevel() using namespace WTF::Unicode; ASSERT(m_status.eor != OtherNeutral || eor.atEnd()); - // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last - // Bidi control characters are included into BidiRun, so last direction - // could be one of the bidi embeddings when there are nested embeddings. - // For example: "‪‫....." - ASSERT(m_status.last == EuropeanNumberSeparator - || m_status.last == EuropeanNumberTerminator - || m_status.last == CommonNumberSeparator - || m_status.last == BoundaryNeutral - || m_status.last == BlockSeparator - || m_status.last == SegmentSeparator - || m_status.last == WhiteSpaceNeutral - || m_status.last == OtherNeutral - || m_status.last == RightToLeftEmbedding - || m_status.last == LeftToRightEmbedding - || m_status.last == RightToLeftOverride - || m_status.last == LeftToRightOverride - || m_status.last == PopDirectionalFormat); + ASSERT(m_status.last != NonSpacingMark + && m_status.last != BoundaryNeutral + && m_status.last != RightToLeftEmbedding + && m_status.last != LeftToRightEmbedding + && m_status.last != RightToLeftOverride + && m_status.last != LeftToRightOverride + && m_status.last != PopDirectionalFormat); if (m_direction == OtherNeutral) m_direction = m_status.lastStrong == LeftToRight ? LeftToRight : RightToLeft; } @@ -342,6 +332,7 @@ void BidiResolver<Iterator, Run>::lowerExplicitEmbeddingLevel(WTF::Unicode::Dire if (!emptyRun && eor != last) { checkDirectionInLowerRaiseEmbeddingLevel(); + // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last if (from == LeftToRight) { // bidi.sor ... bidi.eor ... bidi.last L if (m_status.eor == EuropeanNumber) { @@ -377,6 +368,7 @@ void BidiResolver<Iterator, Run>::raiseExplicitEmbeddingLevel(WTF::Unicode::Dire if (!emptyRun && eor != last) { checkDirectionInLowerRaiseEmbeddingLevel(); + // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last if (to == LeftToRight) { // bidi.sor ... bidi.eor ... bidi.last L if (m_status.eor == EuropeanNumber) { @@ -866,6 +858,11 @@ void BidiResolver<Iterator, Run>::createBidiRunsForLine(const Iterator& end, boo break; case NonSpacingMark: case BoundaryNeutral: + case RightToLeftEmbedding: + case LeftToRightEmbedding: + case RightToLeftOverride: + case LeftToRightOverride: + case PopDirectionalFormat: // ignore these break; case EuropeanNumber: diff --git a/WebCore/rendering/RenderView.cpp b/WebCore/rendering/RenderView.cpp index 9a87329..951bea1 100644 --- a/WebCore/rendering/RenderView.cpp +++ b/WebCore/rendering/RenderView.cpp @@ -158,30 +158,12 @@ void RenderView::mapLocalToContainer(RenderBoxModelObject* repaintContainer, boo // then we should have found it by now. ASSERT_UNUSED(repaintContainer, !repaintContainer || repaintContainer == this); -#ifdef ANDROID_FIXED_ELEMENTS -#if ENABLE(COMPOSITED_FIXED_ELEMENTS) - const Settings * settings = document()->settings(); - if (settings && (settings->viewportWidth() == -1 || settings->viewportWidth() == 0) && - !settings->viewportUserScalable()) -#else - if (false) -#endif -#endif if (fixed && m_frameView) transformState.move(m_frameView->scrollOffset()); } void RenderView::mapAbsoluteToLocalPoint(bool fixed, bool /*useTransforms*/, TransformState& transformState) const { -#ifdef ANDROID_FIXED_ELEMENTS -#if ENABLE(COMPOSITED_FIXED_ELEMENTS) - const Settings * settings = document()->settings(); - if (settings && (settings->viewportWidth() == -1 || settings->viewportWidth() == 0) && - !settings->viewportUserScalable()) -#else - if (false) -#endif -#endif if (fixed && m_frameView) transformState.move(-m_frameView->scrollOffset()); } @@ -331,15 +313,6 @@ void RenderView::computeRectForRepaint(RenderBoxModelObject* repaintContainer, I rect.setX(viewWidth() - rect.right()); } -#ifdef ANDROID_FIXED_ELEMENTS -#if ENABLE(COMPOSITED_FIXED_ELEMENTS) - const Settings * settings = document()->settings(); - if (settings && (settings->viewportWidth() == -1 || settings->viewportWidth() == 0) && - !settings->viewportUserScalable()) -#else - if (false) -#endif -#endif if (fixed && m_frameView) rect.move(m_frameView->scrollX(), m_frameView->scrollY()); diff --git a/WebKit/android/WebCoreSupport/MemoryUsage.cpp b/WebKit/android/WebCoreSupport/MemoryUsage.cpp index f799a18..32cdebf 100644 --- a/WebKit/android/WebCoreSupport/MemoryUsage.cpp +++ b/WebKit/android/WebCoreSupport/MemoryUsage.cpp @@ -78,4 +78,4 @@ int MemoryUsage::memoryUsageMb(bool forceFresh) int MemoryUsage::m_lowMemoryUsageMb = 0; int MemoryUsage::m_highMemoryUsageMb = 0; - +int MemoryUsage::m_highUsageDeltaMb = 0; diff --git a/WebKit/android/WebCoreSupport/MemoryUsage.h b/WebKit/android/WebCoreSupport/MemoryUsage.h index 899fd08..2a3d7ed 100644 --- a/WebKit/android/WebCoreSupport/MemoryUsage.h +++ b/WebKit/android/WebCoreSupport/MemoryUsage.h @@ -31,12 +31,15 @@ public: static int memoryUsageMb(bool forceFresh); static int lowMemoryUsageMb() { return m_lowMemoryUsageMb; } static int highMemoryUsageMb() { return m_highMemoryUsageMb; } + static int highUsageDeltaMb() { return m_highUsageDeltaMb; } static void setHighMemoryUsageMb(int highMemoryUsageMb) { m_highMemoryUsageMb = highMemoryUsageMb; } static void setLowMemoryUsageMb(int lowMemoryUsageMb) { m_lowMemoryUsageMb = lowMemoryUsageMb; } + static void setHighUsageDeltaMb(int highUsageDeltaMb) { m_highUsageDeltaMb = highUsageDeltaMb; } private: static int m_lowMemoryUsageMb; static int m_highMemoryUsageMb; + static int m_highUsageDeltaMb; }; #endif diff --git a/WebKit/android/WebCoreSupport/PlatformBridge.cpp b/WebKit/android/WebCoreSupport/PlatformBridge.cpp index baeddb2..0bc2e3c 100644 --- a/WebKit/android/WebCoreSupport/PlatformBridge.cpp +++ b/WebKit/android/WebCoreSupport/PlatformBridge.cpp @@ -201,6 +201,11 @@ int PlatformBridge::highMemoryUsageMB() return MemoryUsage::highMemoryUsageMb(); } +int PlatformBridge::highUsageDeltaMB() +{ + return MemoryUsage::highUsageDeltaMb(); +} + int PlatformBridge::memoryUsageMB() { return MemoryUsage::memoryUsageMb(false); diff --git a/WebKit/android/jni/WebSettings.cpp b/WebKit/android/jni/WebSettings.cpp index 3712135..4dd183b 100644 --- a/WebKit/android/jni/WebSettings.cpp +++ b/WebKit/android/jni/WebSettings.cpp @@ -509,6 +509,11 @@ public: if (str) { WTF::String localStorageDatabasePath = jstringToWtfString(env,str); if (localStorageDatabasePath.length()) { + localStorageDatabasePath = WebCore::pathByAppendingComponent( + localStorageDatabasePath, "localstorage"); + // We need 770 for folders + mkdir(localStorageDatabasePath.utf8().data(), + permissionFlags660 | S_IXUSR | S_IXGRP); s->setLocalStorageDatabasePath(localStorageDatabasePath); } } diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 1365977..39f6f2d 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -240,6 +240,7 @@ struct WebViewCoreFields { jfieldID m_drawIsPaused; jfieldID m_lowMemoryUsageMb; jfieldID m_highMemoryUsageMb; + jfieldID m_highUsageDeltaMb; } gWebViewCoreFields; // ---------------------------------------------------------------------------- @@ -400,6 +401,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m MemoryUsage::setLowMemoryUsageMb(env->GetIntField(javaWebViewCore, gWebViewCoreFields.m_lowMemoryUsageMb)); MemoryUsage::setHighMemoryUsageMb(env->GetIntField(javaWebViewCore, gWebViewCoreFields.m_highMemoryUsageMb)); + MemoryUsage::setHighUsageDeltaMb(env->GetIntField(javaWebViewCore, gWebViewCoreFields.m_highUsageDeltaMb)); WebViewCore::addInstance(this); @@ -4384,6 +4386,7 @@ int registerWebViewCore(JNIEnv* env) "Unable to find android/webkit/WebViewCore.mDrawIsPaused"); gWebViewCoreFields.m_lowMemoryUsageMb = env->GetFieldID(widget, "mLowMemoryUsageThresholdMb", "I"); gWebViewCoreFields.m_highMemoryUsageMb = env->GetFieldID(widget, "mHighMemoryUsageThresholdMb", "I"); + gWebViewCoreFields.m_highUsageDeltaMb = env->GetFieldID(widget, "mHighUsageDeltaMb", "I"); gWebViewCoreStaticMethods.m_isSupportedMediaMimeType = env->GetStaticMethodID(widget, "isSupportedMediaMimeType", "(Ljava/lang/String;)Z"); diff --git a/WebKit/android/plugins/ANPOpenGLInterface.cpp b/WebKit/android/plugins/ANPOpenGLInterface.cpp index 55eb3e0..8f5f9b4 100644 --- a/WebKit/android/plugins/ANPOpenGLInterface.cpp +++ b/WebKit/android/plugins/ANPOpenGLInterface.cpp @@ -30,6 +30,11 @@ #include "PluginView.h" #include "PluginWidgetAndroid.h" #include "MediaLayer.h" +#include "WebViewCore.h" +#include "Frame.h" +#include "Page.h" +#include "Chrome.h" +#include "ChromeClient.h" using namespace android; @@ -84,6 +89,21 @@ static void anp_releaseTexture(NPP instance, const ANPTextureInfo* textureInfo) texture->producerReleaseAndSwap(); } +static void anp_invertPluginContent(NPP instance, bool isContentInverted) { + WebCore::PluginView* pluginView = pluginViewForInstance(instance); + PluginWidgetAndroid* pluginWidget = pluginView->platformPluginWidget(); + WebCore::MediaLayer* mediaLayer = pluginWidget->getLayer(); + + mediaLayer->invertContents(isContentInverted); + + //force the layer to sync to the UI thread + WebViewCore* wvc = pluginWidget->webViewCore(); + if (wvc) + wvc->mainFrame()->page()->chrome()->client()->scheduleCompositingLayerSync(); +} + + + /////////////////////////////////////////////////////////////////////////////// #define ASSIGN(obj, name) (obj)->name = anp_##name @@ -94,4 +114,5 @@ void ANPOpenGLInterfaceV0_Init(ANPInterface* v) { ASSIGN(i, acquireContext); ASSIGN(i, lockTexture); ASSIGN(i, releaseTexture); + ASSIGN(i, invertPluginContent); } diff --git a/WebKit/android/plugins/ANPOpenGL_npapi.h b/WebKit/android/plugins/ANPOpenGL_npapi.h index bfca0dd..5aabbc4 100644 --- a/WebKit/android/plugins/ANPOpenGL_npapi.h +++ b/WebKit/android/plugins/ANPOpenGL_npapi.h @@ -52,6 +52,12 @@ struct ANPOpenGLInterfaceV0 : ANPInterface { /** */ void (*releaseTexture)(NPP instance, const ANPTextureInfo*); + + /** + * Invert the contents of the plugin on the y-axis. + * default is to not be inverted (i.e. use OpenGL coordinates) + */ + void (*invertPluginContent)(NPP instance, bool isContentInverted); }; #endif //ANPOpenGL_npapi_H diff --git a/WebKit/android/plugins/PluginTimer.cpp b/WebKit/android/plugins/PluginTimer.cpp index ae7cb84..23cac77 100644 --- a/WebKit/android/plugins/PluginTimer.cpp +++ b/WebKit/android/plugins/PluginTimer.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "PluginTimer.h" +#include "RefPtr.h" namespace WebCore { @@ -63,11 +64,14 @@ namespace WebCore { void PluginTimer::fired() { + // ensure the timer cannot be deleted until this method completes + RefPtr<PluginTimer> protector(this); + if (!m_unscheduled) m_timerFunc(m_instance, m_timerID); if (!m_repeat || m_unscheduled) - delete this; + deref(); // mark the timer for deletion as it is no longer needed } // may return null if timerID is not found @@ -84,11 +88,15 @@ namespace WebCore { } /////////////////////////////////////////////////////////////////////////// - + PluginTimerList::~PluginTimerList() { - while (m_list) { - delete m_list; + PluginTimer* curr = m_list; + PluginTimer* next; + while (curr) { + next = curr->next(); + curr->deref(); + curr = next; } } diff --git a/WebKit/android/plugins/PluginTimer.h b/WebKit/android/plugins/PluginTimer.h index dcb29bf..20c0816 100644 --- a/WebKit/android/plugins/PluginTimer.h +++ b/WebKit/android/plugins/PluginTimer.h @@ -27,6 +27,7 @@ #ifndef PluginTimer_H #define PluginTimer_H +#include "RefCounted.h" #include "Timer.h" #include "npapi.h" @@ -34,7 +35,7 @@ namespace WebCore { class PluginTimerList; - class PluginTimer : public TimerBase { + class PluginTimer : public TimerBase, public RefCounted<PluginTimer> { public: PluginTimer(PluginTimer** list, NPP instance, bool repeat, void (*proc)(NPP npp, uint32_t timerID)); diff --git a/WebKit/android/plugins/PluginWidgetAndroid.cpp b/WebKit/android/plugins/PluginWidgetAndroid.cpp index 293c994..73fe18a 100644 --- a/WebKit/android/plugins/PluginWidgetAndroid.cpp +++ b/WebKit/android/plugins/PluginWidgetAndroid.cpp @@ -66,7 +66,7 @@ PluginWidgetAndroid::PluginWidgetAndroid(WebCore::PluginView* view) m_hasFocus = false; m_isFullScreen = false; m_visible = false; - m_zoomLevel = 0; + m_cachedZoomLevel = 0; m_embeddedView = NULL; m_embeddedViewAttached = false; m_acceptEvents = false; @@ -359,15 +359,17 @@ bool PluginWidgetAndroid::isAcceptingEvent(ANPEventFlag flag) { void PluginWidgetAndroid::sendSizeAndVisibilityEvents(const bool updateDimensions) { // TODO update the bitmap size based on the zoom? (for kBitmap_ANPDrawingModel) + const float zoomLevel = m_core->scale(); + // notify the plugin of the new size if (m_drawingModel == kOpenGL_ANPDrawingModel && updateDimensions) { PLUGIN_LOG("%s (%d,%d)[%f]", __FUNCTION__, m_pluginWindow->width, - m_pluginWindow->height, m_zoomLevel); + m_pluginWindow->height, zoomLevel); ANPEvent event; SkANP::InitEvent(&event, kDraw_ANPEventType); event.data.draw.model = kOpenGL_ANPDrawingModel; - event.data.draw.data.surface.width = m_pluginWindow->width * m_zoomLevel; - event.data.draw.data.surface.height = m_pluginWindow->height * m_zoomLevel; + event.data.draw.data.surface.width = m_pluginWindow->width * zoomLevel; + event.data.draw.data.surface.height = m_pluginWindow->height * zoomLevel; sendEvent(event); } @@ -401,10 +403,10 @@ void PluginWidgetAndroid::setVisibleScreen(const ANPRectI& visibleDocRect, float int oldScreenW = m_visibleDocRect.width(); int oldScreenH = m_visibleDocRect.height(); - const bool zoomChanged = m_zoomLevel != zoom; + const bool zoomChanged = m_cachedZoomLevel != zoom; // make local copies of the parameters - m_zoomLevel = zoom; + m_cachedZoomLevel = zoom; m_visibleDocRect.set(visibleDocRect.left, visibleDocRect.top, visibleDocRect.right, diff --git a/WebKit/android/plugins/PluginWidgetAndroid.h b/WebKit/android/plugins/PluginWidgetAndroid.h index f6bc703..fa01b41 100644 --- a/WebKit/android/plugins/PluginWidgetAndroid.h +++ b/WebKit/android/plugins/PluginWidgetAndroid.h @@ -193,7 +193,7 @@ private: bool m_hasFocus; bool m_isFullScreen; bool m_visible; - float m_zoomLevel; + float m_cachedZoomLevel; // used for comparison only jobject m_embeddedView; bool m_embeddedViewAttached; bool m_acceptEvents; |