diff options
Diffstat (limited to 'WebCore/platform')
-rw-r--r-- | WebCore/platform/android/PlatformBridge.h | 1 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/GLUtils.cpp | 10 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp | 17 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/LayerAndroid.cpp | 50 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/LayerAndroid.h | 6 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/LayerTexture.cpp | 51 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/LayerTexture.h | 7 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/MediaLayer.cpp | 10 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/MediaLayer.h | 2 | ||||
-rw-r--r-- | WebCore/platform/text/BidiResolver.h | 31 |
10 files changed, 80 insertions, 105 deletions
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: |