diff options
Diffstat (limited to 'Source/WebCore')
12 files changed, 112 insertions, 30 deletions
diff --git a/Source/WebCore/platform/graphics/android/GLExtras.cpp b/Source/WebCore/platform/graphics/android/GLExtras.cpp index 540ca16..c6cb7f3 100644 --- a/Source/WebCore/platform/graphics/android/GLExtras.cpp +++ b/Source/WebCore/platform/graphics/android/GLExtras.cpp @@ -202,15 +202,8 @@ void GLExtras::drawFindOnPage(SkRect& viewport) void GLExtras::drawGL(IntRect& webViewRect, SkRect& viewport, int titleBarHeight) { if (m_drawExtra) { - // Update the clip. We want to use the screen clip - FloatRect glclip; - glclip.setX(webViewRect.x()); - glclip.setY(webViewRect.y() + titleBarHeight); - glclip.setWidth(webViewRect.width()); - glclip.setHeight(webViewRect.height()); - XLOG("Setting clip [%fx%f, %f, %f]", glclip.x(), glclip.y(), - glclip.width(), glclip.height()); - TilesManager::instance()->shader()->clip(glclip); + // TODO: Support clipping + glDisable(GL_SCISSOR_TEST); if (m_drawExtra == m_ring) drawCursorRings(); else if (m_drawExtra == m_findOnPage) @@ -218,5 +211,6 @@ void GLExtras::drawGL(IntRect& webViewRect, SkRect& viewport, int titleBarHeight else XLOGC("m_drawExtra %p is unknown! (cursor: %p, find: %p", m_drawExtra, m_ring, m_findOnPage); + glEnable(GL_SCISSOR_TEST); } } diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp index 66c0370..2d7b177 100644 --- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp +++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp @@ -31,6 +31,7 @@ #include "BaseLayerAndroid.h" #include "ClassTracker.h" #include "GLUtils.h" +#include "ImagesManager.h" #include "LayerAndroid.h" #include "SkPath.h" #include "TilesManager.h" @@ -447,6 +448,11 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect, // the BaseTiles' texture. TilesManager::instance()->transferQueue()->updateDirtyBaseTiles(); + // Upload any pending ImageTexture + // Return true if we still have some images to upload. + // TODO: upload as many textures as possible within a certain time limit + bool ret = ImagesManager::instance()->uploadTextures(); + if (scale < MIN_SCALE_WARNING || scale > MAX_SCALE_WARNING) XLOGC("WARNING, scale seems corrupted after update: %e", scale); @@ -459,7 +465,7 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect, // set up zoom manager, shaders, etc. m_backgroundColor = baseLayer->getBackgroundColor(); double currentTime = setupDrawing(rect, viewport, webViewRect, titleBarHeight, clip, scale); - bool ret = baseLayer->drawGL(currentTime, compositedRoot, rect, + ret |= baseLayer->drawGL(currentTime, compositedRoot, rect, viewport, scale, buffersSwappedPtr); m_glExtras.drawGL(webViewRect, viewport, titleBarHeight); diff --git a/Source/WebCore/platform/graphics/android/ImageTexture.cpp b/Source/WebCore/platform/graphics/android/ImageTexture.cpp index 814373c..96f7713 100644 --- a/Source/WebCore/platform/graphics/android/ImageTexture.cpp +++ b/Source/WebCore/platform/graphics/android/ImageTexture.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "ImageTexture.h" +#include "ImagesManager.h" #include "SkDevice.h" #include "TilesManager.h" @@ -92,6 +93,14 @@ void ImageTexture::prepareGL() if (m_textureId) return; + ImagesManager::instance()->scheduleTextureUpload(this); +} + +void ImageTexture::uploadGLTexture() +{ + if (m_textureId) + return; + glGenTextures(1, &m_textureId); GLUtils::createTextureWithBitmap(m_textureId, *m_image); } diff --git a/Source/WebCore/platform/graphics/android/ImageTexture.h b/Source/WebCore/platform/graphics/android/ImageTexture.h index 18ff7ef..7f35f06 100644 --- a/Source/WebCore/platform/graphics/android/ImageTexture.h +++ b/Source/WebCore/platform/graphics/android/ImageTexture.h @@ -64,6 +64,7 @@ public: virtual ~ImageTexture(); void prepareGL(); + void uploadGLTexture(); void drawGL(LayerAndroid* painter); void drawCanvas(SkCanvas*, SkRect&); void retain() { m_refCount++; } diff --git a/Source/WebCore/platform/graphics/android/ImagesManager.cpp b/Source/WebCore/platform/graphics/android/ImagesManager.cpp index 3518832..21f9fe9 100644 --- a/Source/WebCore/platform/graphics/android/ImagesManager.cpp +++ b/Source/WebCore/platform/graphics/android/ImagesManager.cpp @@ -105,4 +105,25 @@ ImageTexture* ImagesManager::getTextureForImage(SkBitmapRef* img, bool retain) return image; } +void ImagesManager::scheduleTextureUpload(ImageTexture* texture) +{ + if (m_imagesToUpload.contains(texture)) + return; + + texture->retain(); + m_imagesToUpload.append(texture); +} + +bool ImagesManager::uploadTextures() +{ + // scheduleUpload and uploadTextures are called on the same thread + if (!m_imagesToUpload.size()) + return false; + ImageTexture* texture = m_imagesToUpload.last(); + texture->uploadGLTexture(); + m_imagesToUpload.removeLast(); + removeImage(texture->imageRef()); + return m_imagesToUpload.size(); +} + } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/android/ImagesManager.h b/Source/WebCore/platform/graphics/android/ImagesManager.h index 1b5d322..2fcb9fd 100644 --- a/Source/WebCore/platform/graphics/android/ImagesManager.h +++ b/Source/WebCore/platform/graphics/android/ImagesManager.h @@ -30,6 +30,7 @@ #include "SkBitmap.h" #include "SkBitmapRef.h" #include "SkRefCnt.h" +#include "Vector.h" namespace WebCore { @@ -43,6 +44,8 @@ public: void removeImage(SkBitmapRef* img); ImageTexture* getTextureForImage(SkBitmapRef* img, bool retain = true); void showImages(); + void scheduleTextureUpload(ImageTexture* texture); + bool uploadTextures(); private: ImagesManager() {} @@ -51,6 +54,7 @@ private: android::Mutex m_imagesLock; HashMap<SkBitmapRef*, ImageTexture*> m_images; + Vector<ImageTexture*> m_imagesToUpload; }; } // namespace WebCore diff --git a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp index 4162e0b..4a0e2bb 100644 --- a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -768,6 +768,8 @@ void LayerAndroid::assignTextureTo(LayerAndroid* newTree) bool LayerAndroid::updateWithTree(LayerAndroid* newTree) { +// Disable fast update for now +#if (0) bool needsRepaint = false; int count = this->countChildren(); for (int i = 0; i < count; i++) @@ -778,6 +780,9 @@ bool LayerAndroid::updateWithTree(LayerAndroid* newTree) needsRepaint |= updateWithLayer(newLayer); } return needsRepaint; +#else + return true; +#endif } // Return true to indicate to WebViewCore that the updates diff --git a/Source/WebCore/platform/graphics/android/PaintedSurface.cpp b/Source/WebCore/platform/graphics/android/PaintedSurface.cpp index 1eb51c7..d48c116 100644 --- a/Source/WebCore/platform/graphics/android/PaintedSurface.cpp +++ b/Source/WebCore/platform/graphics/android/PaintedSurface.cpp @@ -53,6 +53,22 @@ namespace WebCore { +PaintedSurface::PaintedSurface(LayerAndroid* layer) + : m_layer(layer) + , m_tiledTexture(0) + , m_scale(0) + , m_pictureUsed(0) +{ + TilesManager::instance()->addPaintedSurface(this); + SkSafeRef(m_layer); +#ifdef DEBUG_COUNT + ClassTracker::instance()->increment("PaintedSurface"); +#endif + m_tiledTexture = new TiledTexture(this); + if (layer && layer->picture()) + m_updateManager.updatePicture(layer->picture()); +} + PaintedSurface::~PaintedSurface() { XLOG("dtor of %x m_layer: %x", this, m_layer); diff --git a/Source/WebCore/platform/graphics/android/PaintedSurface.h b/Source/WebCore/platform/graphics/android/PaintedSurface.h index cda5960..5df76db 100644 --- a/Source/WebCore/platform/graphics/android/PaintedSurface.h +++ b/Source/WebCore/platform/graphics/android/PaintedSurface.h @@ -47,19 +47,7 @@ class UpdateManager; class PaintedSurface : public SkRefCnt { public: - PaintedSurface(LayerAndroid* layer) - : m_layer(layer) - , m_tiledTexture(0) - , m_scale(0) - , m_pictureUsed(0) - { - TilesManager::instance()->addPaintedSurface(this); - SkSafeRef(m_layer); -#ifdef DEBUG_COUNT - ClassTracker::instance()->increment("PaintedSurface"); -#endif - m_tiledTexture = new TiledTexture(this); - } + PaintedSurface(LayerAndroid* layer); virtual ~PaintedSurface(); // PaintedSurface methods diff --git a/Source/WebCore/platform/graphics/android/android_graphics.cpp b/Source/WebCore/platform/graphics/android/android_graphics.cpp index e50cfec..e255d29 100644 --- a/Source/WebCore/platform/graphics/android/android_graphics.cpp +++ b/Source/WebCore/platform/graphics/android/android_graphics.cpp @@ -132,19 +132,19 @@ void CursorRing::setIsButton(const CachedNode* node) bool CursorRing::setup() { - m_node->localCursorRings(m_frame, &m_rings); + m_node->cursorRings(m_frame, &m_rings); if (!m_rings.size()) { DBG_NAV_LOG("!rings.size()"); m_viewImpl->m_hasCursorBounds = false; return false; } setIsButton(m_node); - m_bounds = m_node->localBounds(m_frame); + m_bounds = m_node->bounds(m_frame); m_viewImpl->updateCursorBounds(m_root, m_frame, m_node); bool useHitBounds = m_node->useHitBounds(); if (useHitBounds) - m_bounds = m_node->localHitBounds(m_frame); + m_bounds = m_node->hitBounds(m_frame); if (useHitBounds || m_node->useBounds()) { m_rings.clear(); m_rings.append(m_bounds); diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp index 792b809..8fa021f 100644 --- a/Source/WebCore/rendering/RenderBlock.cpp +++ b/Source/WebCore/rendering/RenderBlock.cpp @@ -226,6 +226,9 @@ void RenderBlock::styleWillChange(StyleDifference diff, const RenderStyle* newSt if (cb->isRenderBlock()) toRenderBlock(cb)->removePositionedObjects(this); } + + if (containsFloats() && !isFloating() && !isPositioned() && (newStyle->position() == AbsolutePosition || newStyle->position() == FixedPosition)) + markAllDescendantsWithFloatsForLayout(); } RenderBox::styleWillChange(diff, newStyle); @@ -269,12 +272,33 @@ void RenderBlock::styleDidChange(StyleDifference diff, const RenderStyle* oldSty } // After our style changed, if we lose our ability to propagate floats into next sibling - // blocks, then we need to mark our descendants with floats for layout and clear all floats - // from next sibling blocks that exist in our floating objects list. See bug 56299. + // blocks, then we need to find the top most parent containing that overhanging float and + // then mark its descendants with floats for layout and clear all floats from its next + // sibling blocks that exist in our floating objects list. See bug 56299 and 62875. bool canPropagateFloatIntoSibling = !isFloatingOrPositioned() && !avoidsFloats(); if (diff == StyleDifferenceLayout && s_canPropagateFloatIntoSibling && !canPropagateFloatIntoSibling && hasOverhangingFloats()) { - markAllDescendantsWithFloatsForLayout(); - markSiblingsWithFloatsForLayout(); + RenderBlock* parentBlock = this; + FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); + FloatingObjectSetIterator end = floatingObjectSet.end(); + + for (RenderObject* curr = parent(); curr && !curr->isRenderView(); curr = curr->parent()) { + if (curr->isRenderBlock()) { + RenderBlock* currBlock = toRenderBlock(curr); + + if (currBlock->hasOverhangingFloats()) { + for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { + RenderBox* renderer = (*it)->renderer(); + if (currBlock->hasOverhangingFloat(renderer)) { + parentBlock = currBlock; + break; + } + } + } + } + } + + parentBlock->markAllDescendantsWithFloatsForLayout(); + parentBlock->markSiblingsWithFloatsForLayout(); } } @@ -3738,6 +3762,19 @@ int RenderBlock::addOverhangingFloats(RenderBlock* child, int logicalLeftOffset, return lowestFloatLogicalBottom; } +bool RenderBlock::hasOverhangingFloat(RenderBox* renderer) +{ + if (!m_floatingObjects || hasColumns() || !parent()) + return false; + + FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); + FloatingObjectSetIterator it = floatingObjectSet.find<RenderBox*, FloatingObjectHashTranslator>(renderer); + if (it == floatingObjectSet.end()) + return false; + + return logicalBottomForFloat(*it) > logicalHeight(); +} + void RenderBlock::addIntrudingFloats(RenderBlock* prev, int logicalLeftOffset, int logicalTopOffset) { // If the parent or previous sibling doesn't have any floats to add, don't bother. diff --git a/Source/WebCore/rendering/RenderBlock.h b/Source/WebCore/rendering/RenderBlock.h index d45ab66..7ca13c6 100644 --- a/Source/WebCore/rendering/RenderBlock.h +++ b/Source/WebCore/rendering/RenderBlock.h @@ -542,6 +542,7 @@ private: virtual bool avoidsFloats() const; bool hasOverhangingFloats() { return parent() && !hasColumns() && containsFloats() && lowestFloatLogicalBottom() > logicalHeight(); } + bool hasOverhangingFloat(RenderBox*); void addIntrudingFloats(RenderBlock* prev, int xoffset, int yoffset); int addOverhangingFloats(RenderBlock* child, int xoffset, int yoffset, bool makeChildPaintOtherFloats); |