summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/WebCore/loader/FrameLoader.cpp2
-rw-r--r--Source/WebCore/platform/graphics/android/BaseTile.cpp7
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.cpp2
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.h4
-rw-r--r--Source/WebCore/platform/graphics/android/PaintTileOperation.h7
-rw-r--r--Source/WebCore/platform/graphics/android/PaintedSurface.cpp13
-rw-r--r--Source/WebCore/platform/graphics/android/PaintedSurface.h3
-rw-r--r--Source/WebCore/platform/graphics/android/TiledTexture.cpp145
-rw-r--r--Source/WebCore/platform/graphics/android/TiledTexture.h38
-rw-r--r--Source/WebCore/platform/graphics/android/TilesManager.cpp4
-rw-r--r--Source/WebCore/rendering/RenderBlock.cpp6
-rw-r--r--Source/WebCore/rendering/RenderObject.cpp4
-rw-r--r--Source/WebCore/rendering/RenderObject.h4
-rw-r--r--Source/WebCore/rendering/RenderObjectChildList.cpp23
-rw-r--r--Source/WebKit/android/WebCoreSupport/WebCache.cpp39
15 files changed, 213 insertions, 88 deletions
diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp
index 2def2a6..85b1541 100644
--- a/Source/WebCore/loader/FrameLoader.cpp
+++ b/Source/WebCore/loader/FrameLoader.cpp
@@ -2743,7 +2743,7 @@ void FrameLoader::addExtraFieldsToRequest(ResourceRequest& request, FrameLoadTyp
request.setCachePolicy(UseProtocolCachePolicy);
} else if (loadType == FrameLoadTypeReload || loadType == FrameLoadTypeReloadFromOrigin || request.isConditional())
request.setCachePolicy(ReloadIgnoringCacheData);
- else if (isBackForwardLoadType(loadType) && m_stateMachine.committedFirstRealDocumentLoad() && !request.url().protocolIs("https"))
+ else if (isBackForwardLoadType(loadType) && m_stateMachine.committedFirstRealDocumentLoad())
request.setCachePolicy(ReturnCacheDataElseLoad);
if (request.cachePolicy() == ReloadIgnoringCacheData) {
diff --git a/Source/WebCore/platform/graphics/android/BaseTile.cpp b/Source/WebCore/platform/graphics/android/BaseTile.cpp
index f0b0dd2..98eb623 100644
--- a/Source/WebCore/platform/graphics/android/BaseTile.cpp
+++ b/Source/WebCore/platform/graphics/android/BaseTile.cpp
@@ -190,13 +190,14 @@ void BaseTile::markAsDirty(int unsigned pictureCount,
// current paint
m_state = Unpainted;
} else if (m_state != Unpainted) {
- // layer tiles and prefetch page tiles are potentially marked dirty
- // while in the process of painting, due to not using an update lock
-
// TODO: fix it so that they can paint while deferring the markAsDirty
// call (or block updates)
XLOG("Warning: tried to mark tile %p at %d, %d islayertile %d as dirty, state %d, page %p",
this, m_x, m_y, isLayerTile(), m_state, m_page);
+
+ // prefetch tiles can be marked dirty while in the process of painting,
+ // due to not using an update lock. force them to fail validate step.
+ m_state = Unpainted;
}
}
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
index f931f22..7b43305 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -86,6 +86,7 @@ GLWebViewState::GLWebViewState(android::Mutex* buttonMutex)
, m_goingLeft(false)
, m_expandedTileBoundsX(0)
, m_expandedTileBoundsY(0)
+ , m_scale(1)
{
m_viewport.setEmpty();
m_futureViewportTileBounds.setEmpty();
@@ -405,6 +406,7 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
IntRect& webViewRect, int titleBarHeight,
IntRect& clip, float scale, bool* buffersSwappedPtr)
{
+ m_scale = scale;
TilesManager::instance()->getProfiler()->nextFrame(viewport.fLeft,
viewport.fTop,
viewport.fRight,
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.h b/Source/WebCore/platform/graphics/android/GLWebViewState.h
index 2f7e16d..b2aab88 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.h
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.h
@@ -230,6 +230,8 @@ public:
int expandedTileBoundsX() { return m_expandedTileBoundsX; }
int expandedTileBoundsY() { return m_expandedTileBoundsY; }
+ float scale() { return m_scale; }
+
private:
void inval(const IntRect& rect); // caller must hold m_baseLayerLock
void invalRegion(const SkRegion& region);
@@ -273,6 +275,8 @@ private:
int m_expandedTileBoundsX;
int m_expandedTileBoundsY;
+
+ float m_scale;
};
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/android/PaintTileOperation.h b/Source/WebCore/platform/graphics/android/PaintTileOperation.h
index 57bbd8b..65d20f2 100644
--- a/Source/WebCore/platform/graphics/android/PaintTileOperation.h
+++ b/Source/WebCore/platform/graphics/android/PaintTileOperation.h
@@ -52,17 +52,20 @@ private:
class ScaleFilter : public OperationFilter {
public:
- ScaleFilter(float scale) : m_scale(scale) {}
+ ScaleFilter(TilePainter* painter, float scale)
+ : m_painter(painter)
+ , m_scale(scale) {}
virtual bool check(QueuedOperation* operation)
{
if (operation->type() == QueuedOperation::PaintTile) {
PaintTileOperation* op = static_cast<PaintTileOperation*>(operation);
- if (op->scale() != m_scale)
+ if ((op->painter() == m_painter) && (op->scale() != m_scale))
return true;
}
return false;
}
private:
+ TilePainter* m_painter;
float m_scale;
};
diff --git a/Source/WebCore/platform/graphics/android/PaintedSurface.cpp b/Source/WebCore/platform/graphics/android/PaintedSurface.cpp
index c5ed38c..0957c0c 100644
--- a/Source/WebCore/platform/graphics/android/PaintedSurface.cpp
+++ b/Source/WebCore/platform/graphics/android/PaintedSurface.cpp
@@ -68,7 +68,7 @@ PaintedSurface::PaintedSurface(LayerAndroid* layer)
#ifdef DEBUG_COUNT
ClassTracker::instance()->increment("PaintedSurface");
#endif
- m_tiledTexture = new TiledTexture(this);
+ m_tiledTexture = new DualTiledTexture(this);
if (layer && layer->picture())
m_updateManager.updatePicture(layer->picture());
}
@@ -142,7 +142,6 @@ void PaintedSurface::prepare(GLWebViewState* state)
m_layer->uniqueId(), m_layer,
m_layer->getScale());
- float scale = m_layer->getScale();
int w = m_layer->getSize().width();
int h = m_layer->getSize().height();
@@ -154,13 +153,13 @@ void PaintedSurface::prepare(GLWebViewState* state)
computeVisibleArea();
- if (scale != m_scale)
- m_scale = scale;
+ m_scale = state->scale();
- XLOG("layer %d %x prepared at size (%d, %d) @ scale %.2f", m_layer->uniqueId(),
- m_layer, w, h, scale);
+ XLOGC("%x layer %d %x prepared at size (%d, %d) @ scale %.2f", this, m_layer->uniqueId(),
+ m_layer, w, h, m_scale);
- m_tiledTexture->prepare(state, m_pictureUsed != m_layer->pictureUsed(), startFastSwap);
+ m_tiledTexture->prepare(state, m_scale, m_pictureUsed != m_layer->pictureUsed(),
+ startFastSwap, m_visibleArea);
}
bool PaintedSurface::draw()
diff --git a/Source/WebCore/platform/graphics/android/PaintedSurface.h b/Source/WebCore/platform/graphics/android/PaintedSurface.h
index 5df76db..761be74 100644
--- a/Source/WebCore/platform/graphics/android/PaintedSurface.h
+++ b/Source/WebCore/platform/graphics/android/PaintedSurface.h
@@ -75,13 +75,12 @@ public:
float scale() { return m_scale; }
float opacity();
unsigned int pictureUsed() { return m_pictureUsed; }
- TiledTexture* texture() { return m_tiledTexture; }
private:
UpdateManager m_updateManager;
LayerAndroid* m_layer;
- TiledTexture* m_tiledTexture;
+ DualTiledTexture* m_tiledTexture;
IntRect m_area;
IntRect m_visibleArea;
diff --git a/Source/WebCore/platform/graphics/android/TiledTexture.cpp b/Source/WebCore/platform/graphics/android/TiledTexture.cpp
index ce4dc7f..87996ab 100644
--- a/Source/WebCore/platform/graphics/android/TiledTexture.cpp
+++ b/Source/WebCore/platform/graphics/android/TiledTexture.cpp
@@ -54,7 +54,28 @@
namespace WebCore {
-void TiledTexture::prepare(GLWebViewState* state, bool repaint, bool startFastSwap)
+bool TiledTexture::ready() {
+ bool tilesAllReady = true;
+ bool tilesVisible = false;
+ for (unsigned int i = 0; i < m_tiles.size(); i++) {
+ BaseTile* tile = m_tiles[i];
+ if (tile->isTileVisible(m_area) && !tile->isTileReady()) {
+ tilesAllReady = false;
+ break;
+ }
+ if (tile->isTileVisible(m_area))
+ tilesVisible = true;
+ }
+ // For now, if no textures are available, consider ourselves as ready
+ // in order to unblock the zooming process.
+ // FIXME: have a better system -- maybe keeping the last scale factor
+ // able to fully render everything
+ return !TilesManager::instance()->layerTexturesRemain()
+ || (tilesAllReady && tilesVisible);
+}
+
+void TiledTexture::prepare(GLWebViewState* state, float scale, bool repaint,
+ bool startFastSwap, IntRect& visibleArea)
{
if (!m_surface)
return;
@@ -63,11 +84,10 @@ void TiledTexture::prepare(GLWebViewState* state, bool repaint, bool startFastSw
return;
// first, how many tiles do we need
- IntRect visibleArea = m_surface->visibleArea();
- IntRect area(visibleArea.x() * m_surface->scale(),
- visibleArea.y() * m_surface->scale(),
- ceilf(visibleArea.width() * m_surface->scale()),
- ceilf(visibleArea.height() * m_surface->scale()));
+ IntRect area(visibleArea.x() * scale,
+ visibleArea.y() * scale,
+ ceilf(visibleArea.width() * scale),
+ ceilf(visibleArea.height() * scale));
if (area.width() == 0 && area.height() == 0) {
m_area.setWidth(0);
@@ -85,8 +105,8 @@ void TiledTexture::prepare(GLWebViewState* state, bool repaint, bool startFastSw
m_area.setWidth(ceilf(right) - m_area.x());
m_area.setHeight(ceilf(bottom) - m_area.y());
- XLOG("for TiledTexture %p, we have a visible area of %d, %d - %d x %d, corresponding to %d, %d x - %d x %d tiles",
- this,
+ XLOG("for TiledTexture %p, we prepare with scale %.2f, have a visible area of %d, %d - %d x %d, corresponding to %d, %d x - %d x %d tiles",
+ this, scale,
visibleArea.x(), visibleArea.y(),
visibleArea.width(), visibleArea.height(),
m_area.x(), m_area.y(),
@@ -95,20 +115,13 @@ void TiledTexture::prepare(GLWebViewState* state, bool repaint, bool startFastSw
bool goingDown = m_prevTileY < m_area.y();
m_prevTileY = m_area.y();
- if (m_surface->scale() != m_prevScale)
- TilesManager::instance()->removeOperationsForFilter(new ScaleFilter(m_surface->scale()));
+ if (scale != m_scale)
+ TilesManager::instance()->removeOperationsForFilter(new ScaleFilter(this, scale));
- m_prevScale = m_surface->scale();
+ m_scale = scale;
// unlock if tiles all ready
- bool tilesAllReady = true;
- for (unsigned int i = 0; i < m_tiles.size(); i++) {
- BaseTile* tile = m_tiles[i];
- if (tile->isTileVisible(m_area) && !tile->isTileReady()) {
- tilesAllReady = false;
- break;
- }
- }
+ bool tilesAllReady = ready();
// startFastSwap=true will swap all ready tiles each
// frame until all visible tiles are up to date
@@ -173,7 +186,7 @@ void TiledTexture::prepareTile(bool repaint, int x, int y)
}
XLOG("preparing tile %p, painter is this %p", tile, this);
- tile->setContents(this, x, y, m_surface->scale());
+ tile->setContents(this, x, y, m_scale);
// TODO: move below (which is largely the same for layers / tiled page) into
// prepare() function
@@ -210,10 +223,9 @@ bool TiledTexture::draw()
TilesManager::instance()->getTilesTracker()->trackVisibleLayer();
#endif
- float m_invScale = 1 / m_surface->scale();
+ float m_invScale = 1 / m_scale;
const float tileWidth = TilesManager::layerTileWidth() * m_invScale;
const float tileHeight = TilesManager::layerTileHeight() * m_invScale;
- XLOG("draw tile %x, tiles %d", this, m_tiles.size());
bool askRedraw = false;
for (unsigned int i = 0; i < m_tiles.size(); i++) {
@@ -226,10 +238,10 @@ bool TiledTexture::draw()
rect.fTop = tile->y() * tileHeight;
rect.fRight = rect.fLeft + tileWidth;
rect.fBottom = rect.fTop + tileHeight;
- XLOG(" - [%d], { painter %x vs %x }, tile %x %d,%d at scale %.2f [ready: %d] dirty: %d",
+ XLOG(" - [%d], { painter %x vs %x }, tile %x %d,%d at scale %.2f vs %.2f [ready: %d] dirty: %d",
i, this, tile->painter(), tile, tile->x(), tile->y(),
- tile->scale(), tile->isTileReady(), tile->isDirty());
- tile->draw(m_surface->opacity(), rect, m_surface->scale());
+ tile->scale(), m_scale, tile->isTileReady(), tile->isDirty());
+ tile->draw(m_surface->opacity(), rect, m_scale);
#ifdef DEBUG
TilesManager::instance()->getTilesTracker()->track(tile->isTileReady(), tile->backTexture());
#endif
@@ -260,6 +272,13 @@ void TiledTexture::removeTiles()
for (unsigned int i = 0; i < m_tiles.size(); i++) {
delete m_tiles[i];
}
+ m_tiles.clear();
+}
+
+void TiledTexture::discardTextures()
+{
+ for (unsigned int i = 0; i < m_tiles.size(); i++)
+ m_tiles[i]->discardTextures();
}
bool TiledTexture::owns(BaseTileTexture* texture)
@@ -274,4 +293,80 @@ bool TiledTexture::owns(BaseTileTexture* texture)
return false;
}
+DualTiledTexture::DualTiledTexture(PaintedSurface* surface)
+{
+ m_textureA = new TiledTexture(surface);
+ m_textureB = new TiledTexture(surface);
+ m_frontTexture = m_textureA;
+ m_backTexture = m_textureB;
+ m_scale = -1;
+ m_futureScale = -1;
+ m_zooming = false;
+}
+
+DualTiledTexture::~DualTiledTexture()
+{
+ delete m_textureA;
+ delete m_textureB;
+}
+
+void DualTiledTexture::prepare(GLWebViewState* state, float scale, bool repaint,
+ bool startFastSwap, IntRect& visibleArea)
+{
+ // If we are zooming, we will use the previously used area, to prevent the
+ // frontTexture to try to allocate more tiles than what it has already
+ if (!m_zooming)
+ m_preZoomVisibleArea = visibleArea;
+
+ if (m_futureScale != scale) {
+ m_futureScale = scale;
+ m_zoomUpdateTime = WTF::currentTime() + DualTiledTexture::s_zoomUpdateDelay;
+ m_zooming = true;
+ }
+
+ XLOG("\n*** %x Drawing with scale %.2f, futureScale: %.2f, zooming: %d",
+ this, scale, m_futureScale, m_zooming);
+
+ if (m_scale > 0)
+ m_frontTexture->prepare(state, m_scale, repaint, startFastSwap, m_preZoomVisibleArea);
+
+ // If we had a scheduled update
+ if (m_zooming && m_zoomUpdateTime < WTF::currentTime()) {
+ m_backTexture->prepare(state, m_futureScale, repaint, startFastSwap, visibleArea);
+ if (m_backTexture->ready()) {
+ swap();
+ m_zooming = false;
+ }
+ }
+}
+
+void DualTiledTexture::swap()
+{
+ m_frontTexture = m_frontTexture == m_textureA ? m_textureB : m_textureA;
+ m_backTexture = m_backTexture == m_textureA ? m_textureB : m_textureA;
+ m_scale = m_futureScale;
+ m_backTexture->discardTextures();
+}
+
+bool DualTiledTexture::draw()
+{
+ bool needsRepaint = m_frontTexture->draw();
+ needsRepaint |= m_zooming;
+ needsRepaint |= (m_scale <= 0);
+ return needsRepaint;
+}
+
+void DualTiledTexture::update(const SkRegion& dirtyArea, SkPicture* picture)
+{
+ m_backTexture->update(dirtyArea, picture);
+ m_frontTexture->update(dirtyArea, picture);
+}
+
+bool DualTiledTexture::owns(BaseTileTexture* texture)
+{
+ bool owns = m_textureA->owns(texture);
+ owns |= m_textureB->owns(texture);
+ return owns;
+}
+
} // namespace WebCore
diff --git a/Source/WebCore/platform/graphics/android/TiledTexture.h b/Source/WebCore/platform/graphics/android/TiledTexture.h
index aa82e36..206961b 100644
--- a/Source/WebCore/platform/graphics/android/TiledTexture.h
+++ b/Source/WebCore/platform/graphics/android/TiledTexture.h
@@ -49,7 +49,7 @@ public:
: m_surface(surface)
, m_prevTileX(0)
, m_prevTileY(0)
- , m_prevScale(1)
+ , m_scale(1)
, m_swapWhateverIsReady(false)
{
m_dirtyRegion.setEmpty();
@@ -65,7 +65,8 @@ public:
removeTiles();
};
- void prepare(GLWebViewState* state, bool repaint, bool startFastSwap);
+ void prepare(GLWebViewState* state, float scale, bool repaint,
+ bool startFastSwap, IntRect& visibleArea);
bool draw();
void prepareTile(bool repaint, int x, int y);
@@ -74,6 +75,7 @@ public:
BaseTile* getTile(int x, int y);
void removeTiles();
+ void discardTextures();
bool owns(BaseTileTexture* texture);
// TilePainter methods
@@ -81,6 +83,11 @@ public:
virtual void paintExtra(SkCanvas*);
virtual const TransformationMatrix* transform();
+ float scale() { return m_scale; }
+ bool ready();
+
+ PaintedSurface* surface() { return m_surface; }
+
private:
bool tileIsVisible(BaseTile* tile);
@@ -96,11 +103,36 @@ private:
int m_prevTileX;
int m_prevTileY;
- float m_prevScale;
+ float m_scale;
bool m_swapWhateverIsReady;
};
+class DualTiledTexture {
+public:
+ DualTiledTexture(PaintedSurface* surface);
+ ~DualTiledTexture();
+ void prepare(GLWebViewState* state, float scale, bool repaint,
+ bool startFastSwap, IntRect& area);
+ void swap();
+ bool draw();
+ void update(const SkRegion& dirtyArea, SkPicture* picture);
+ bool owns(BaseTileTexture* texture);
+private:
+ // Delay before we schedule a new tile at the new scale factor
+ static const double s_zoomUpdateDelay = 0.2; // 200 ms
+
+ TiledTexture* m_frontTexture;
+ TiledTexture* m_backTexture;
+ TiledTexture* m_textureA;
+ TiledTexture* m_textureB;
+ float m_scale;
+ float m_futureScale;
+ double m_zoomUpdateTime;
+ bool m_zooming;
+ IntRect m_preZoomVisibleArea;
+};
+
} // namespace WebCore
#endif // TiledTexture_h
diff --git a/Source/WebCore/platform/graphics/android/TilesManager.cpp b/Source/WebCore/platform/graphics/android/TilesManager.cpp
index 74cc764..dd2b169 100644
--- a/Source/WebCore/platform/graphics/android/TilesManager.cpp
+++ b/Source/WebCore/platform/graphics/android/TilesManager.cpp
@@ -277,7 +277,7 @@ BaseTileTexture* TilesManager::getAvailableTexture(BaseTile* owner)
const unsigned int max = availableTexturePool->size();
for (unsigned int i = 0; i < max; i++) {
BaseTileTexture* texture = (*availableTexturePool)[i];
- TextureOwner* currentOwner = texture->owner();
+ BaseTile* currentOwner = static_cast<BaseTile*>(texture->owner());
if (texture->busy()) {
// don't bother, since the acquire() will likely fail
@@ -296,7 +296,7 @@ BaseTileTexture* TilesManager::getAvailableTexture(BaseTile* owner)
continue;
}
- if (currentOwner->page() == owner->page() && texture->scale() != owner->scale()) {
+ if (currentOwner->painter() == owner->painter() && texture->scale() != owner->scale()) {
// if we render the back page with one scale, then another while
// still zooming, we recycle the tiles with the old scale instead of
// taking ones from the front page
diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp
index 8fa021f..373523d 100644
--- a/Source/WebCore/rendering/RenderBlock.cpp
+++ b/Source/WebCore/rendering/RenderBlock.cpp
@@ -1554,13 +1554,9 @@ bool RenderBlock::handleRunInChild(RenderBox* child)
if (!child->isRenderBlock())
return false;
- // Get the next non-positioned/non-floating RenderBlock.
RenderBlock* blockRunIn = toRenderBlock(child);
RenderObject* curr = blockRunIn->nextSibling();
- while (curr && curr->isFloatingOrPositioned())
- curr = curr->nextSibling();
-
- if (!curr || !curr->isRenderBlock() || !curr->childrenInline() || curr->isRunIn() || curr->isAnonymous())
+ if (!curr || !curr->isRenderBlock() || !curr->childrenInline() || curr->isRunIn() || curr->isAnonymous() || curr->isFloatingOrPositioned())
return false;
RenderBlock* currBlock = toRenderBlock(curr);
diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp
index b050539..8caef04 100644
--- a/Source/WebCore/rendering/RenderObject.cpp
+++ b/Source/WebCore/rendering/RenderObject.cpp
@@ -366,7 +366,7 @@ RenderObject* RenderObject::nextInPreOrderAfterChildren() const
return o;
}
-RenderObject* RenderObject::nextInPreOrder(RenderObject* stayWithin) const
+RenderObject* RenderObject::nextInPreOrder(const RenderObject* stayWithin) const
{
if (RenderObject* o = firstChild())
return o;
@@ -374,7 +374,7 @@ RenderObject* RenderObject::nextInPreOrder(RenderObject* stayWithin) const
return nextInPreOrderAfterChildren(stayWithin);
}
-RenderObject* RenderObject::nextInPreOrderAfterChildren(RenderObject* stayWithin) const
+RenderObject* RenderObject::nextInPreOrderAfterChildren(const RenderObject* stayWithin) const
{
if (this == stayWithin)
return 0;
diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h
index 14a40e9..005c453 100644
--- a/Source/WebCore/rendering/RenderObject.h
+++ b/Source/WebCore/rendering/RenderObject.h
@@ -158,9 +158,9 @@ public:
virtual const RenderObjectChildList* virtualChildren() const { return 0; }
RenderObject* nextInPreOrder() const;
- RenderObject* nextInPreOrder(RenderObject* stayWithin) const;
+ RenderObject* nextInPreOrder(const RenderObject* stayWithin) const;
RenderObject* nextInPreOrderAfterChildren() const;
- RenderObject* nextInPreOrderAfterChildren(RenderObject* stayWithin) const;
+ RenderObject* nextInPreOrderAfterChildren(const RenderObject* stayWithin) const;
RenderObject* previousInPreOrder() const;
RenderObject* childAt(unsigned) const;
diff --git a/Source/WebCore/rendering/RenderObjectChildList.cpp b/Source/WebCore/rendering/RenderObjectChildList.cpp
index 1ea8675..92f3b16 100644
--- a/Source/WebCore/rendering/RenderObjectChildList.cpp
+++ b/Source/WebCore/rendering/RenderObjectChildList.cpp
@@ -269,10 +269,10 @@ RenderObject* RenderObjectChildList::beforePseudoElementRenderer(const RenderObj
// generated inline run-in in the next level of children.
RenderObject* first = const_cast<RenderObject*>(owner);
do {
- // Skip list markers and generated run-ins
first = first->firstChild();
- while (first && (first->isListMarker() || (first->isRenderInline() && first->isRunIn() && first->isAnonymous())))
- first = first->nextSibling();
+ // Skip list markers and generated run-ins.
+ while (first && (first->isListMarker() || (first->isRenderInline() && first->isRunIn())))
+ first = first->nextInPreOrderAfterChildren(owner);
} while (first && first->isAnonymous() && first->style()->styleType() == NOPSEUDO);
if (!first)
@@ -282,20 +282,17 @@ RenderObject* RenderObjectChildList::beforePseudoElementRenderer(const RenderObj
return first;
// Check for a possible generated run-in, using run-in positioning rules.
- // Skip inlines and floating / positioned blocks, and place as the first child.
first = owner->firstChild();
if (!first->isRenderBlock())
return 0;
- while (first && first->isFloatingOrPositioned())
+
+ first = first->firstChild();
+ // We still need to skip any list markers that could exist before the run-in.
+ while (first && first->isListMarker())
first = first->nextSibling();
- if (first) {
- first = first->firstChild();
- // We still need to skip any list markers that could exist before the run-in.
- while (first && first->isListMarker())
- first = first->nextSibling();
- if (first && first->style()->styleType() == BEFORE && first->isRenderInline() && first->isRunIn() && first->isAnonymous())
- return first;
- }
+ if (first && first->style()->styleType() == BEFORE && first->isRenderInline() && first->isRunIn())
+ return first;
+
return 0;
}
diff --git a/Source/WebKit/android/WebCoreSupport/WebCache.cpp b/Source/WebKit/android/WebCoreSupport/WebCache.cpp
index 3c49430..9b505ee 100644
--- a/Source/WebKit/android/WebCoreSupport/WebCache.cpp
+++ b/Source/WebKit/android/WebCoreSupport/WebCache.cpp
@@ -42,28 +42,20 @@ namespace android {
static WTF::Mutex instanceMutex;
-static const string& rootDirectory()
-{
- // This method may be called on any thread, as the Java method is
- // synchronized.
- static WTF::Mutex mutex;
- MutexLocker lock(mutex);
- static string cacheDirectory;
- if (cacheDirectory.empty()) {
- JNIEnv* env = JSC::Bindings::getJNIEnv();
- jclass bridgeClass = env->FindClass("android/webkit/JniUtil");
- jmethodID method = env->GetStaticMethodID(bridgeClass, "getCacheDirectory", "()Ljava/lang/String;");
- cacheDirectory = jstringToStdString(env, static_cast<jstring>(env->CallStaticObjectMethod(bridgeClass, method)));
- env->DeleteLocalRef(bridgeClass);
- }
- return cacheDirectory;
-}
-
static string storageDirectory()
{
- // Private cache is currently in memory only
static const char* const kDirectory = "/webviewCacheChromium";
- string storageDirectory = rootDirectory();
+
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ jclass bridgeClass = env->FindClass("android/webkit/JniUtil");
+ jmethodID method = env->GetStaticMethodID(bridgeClass, "getCacheDirectory", "()Ljava/lang/String;");
+ string storageDirectory = jstringToStdString(env, static_cast<jstring>(env->CallStaticObjectMethod(bridgeClass, method)));
+ env->DeleteLocalRef(bridgeClass);
+
+ // Return empty string if storageDirectory is an empty string
+ if (storageDirectory.empty())
+ return storageDirectory;
+
storageDirectory.append(kDirectory);
return storageDirectory;
}
@@ -111,8 +103,13 @@ WebCache::WebCache(bool isPrivateBrowsing)
if (isPrivateBrowsing)
backendFactory = net::HttpCache::DefaultBackend::InMemory(kMaximumCacheSizeBytes / 2);
else {
- FilePath directoryPath(storageDirectory().c_str());
- backendFactory = new net::HttpCache::DefaultBackend(net::DISK_CACHE, directoryPath, kMaximumCacheSizeBytes, cacheMessageLoopProxy);
+ string storage(storageDirectory());
+ if (storage.empty()) // Can't get a storage directory from the OS
+ backendFactory = net::HttpCache::DefaultBackend::InMemory(kMaximumCacheSizeBytes / 2);
+ else {
+ FilePath directoryPath(storage.c_str());
+ backendFactory = new net::HttpCache::DefaultBackend(net::DISK_CACHE, directoryPath, kMaximumCacheSizeBytes, cacheMessageLoopProxy);
+ }
}
m_cache = new net::HttpCache(m_hostResolver.get(),