diff options
Diffstat (limited to 'Source/WebCore')
9 files changed, 50 insertions, 42 deletions
diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp index f332074..8f2958c 100644 --- a/Source/WebCore/page/FrameView.cpp +++ b/Source/WebCore/page/FrameView.cpp @@ -1745,6 +1745,11 @@ void FrameView::scheduleRelayout() m_frame->ownerRenderer()->setNeedsLayout(true, true); } +#ifdef ANDROID_FLATTEN_FRAMESET + if (m_frame->ownerRenderer() && m_frame->ownerElement()->hasTagName(frameTag)) + m_frame->ownerRenderer()->setNeedsLayoutAndPrefWidthsRecalc(); +#endif + int delay = m_frame->document()->minimumLayoutDelay(); if (m_layoutTimer.isActive() && m_delayedLayout && !delay) unscheduleRelayout(); diff --git a/Source/WebCore/platform/graphics/android/BaseTile.cpp b/Source/WebCore/platform/graphics/android/BaseTile.cpp index b5c0f0a..d15feeb 100644 --- a/Source/WebCore/platform/graphics/android/BaseTile.cpp +++ b/Source/WebCore/platform/graphics/android/BaseTile.cpp @@ -48,7 +48,6 @@ namespace WebCore { BaseTile::BaseTile(bool isLayerTile) : m_glWebViewState(0) - , m_painter(0) , m_x(-1) , m_y(-1) , m_page(0) @@ -85,11 +84,10 @@ BaseTile::~BaseTile() // All the following functions must be called from the main GL thread. -void BaseTile::setContents(TilePainter* painter, int x, int y, float scale) +void BaseTile::setContents(int x, int y, float scale) { // TODO: investigate whether below check/discard is necessary - if (!painter - || (m_x != x) + if ((m_x != x) || (m_y != y) || (m_scale != scale)) { // neither texture is relevant @@ -97,7 +95,6 @@ void BaseTile::setContents(TilePainter* painter, int x, int y, float scale) } android::AutoMutex lock(m_atomicSync); - m_painter = painter; m_x = x; m_y = y; m_scale = scale; @@ -288,7 +285,7 @@ bool BaseTile::isTileVisible(const IntRect& viewTileBounds) } // This is called from the texture generation thread -void BaseTile::paintBitmap() +void BaseTile::paintBitmap(TilePainter* painter) { // We acquire the values below atomically. This ensures that we are reading // values correctly across cores. Further, once we have these values they @@ -300,7 +297,6 @@ void BaseTile::paintBitmap() float scale = m_scale; const int x = m_x; const int y = m_y; - TilePainter* painter = m_painter; if (!dirty || !texture) { m_atomicSync.unlock(); diff --git a/Source/WebCore/platform/graphics/android/BaseTile.h b/Source/WebCore/platform/graphics/android/BaseTile.h index f02386b..ab16dc9 100644 --- a/Source/WebCore/platform/graphics/android/BaseTile.h +++ b/Source/WebCore/platform/graphics/android/BaseTile.h @@ -94,7 +94,7 @@ public: bool isLayerTile() { return m_isLayerTile; } - void setContents(TilePainter* painter, int x, int y, float scale); + void setContents(int x, int y, float scale); void setPage(TiledPage* page) { m_page = page; } void reserveTexture(); @@ -105,7 +105,7 @@ public: const TransformationMatrix* transform); // the only thread-safe function called by the background thread - void paintBitmap(); + void paintBitmap(TilePainter* painter); bool intersectWithRect(int x, int y, int tileWidth, int tileHeight, float scale, const SkRect& dirtyRect, @@ -138,14 +138,12 @@ public: virtual bool removeTexture(BaseTileTexture* texture); virtual TiledPage* page() { return m_page; } virtual GLWebViewState* state() { return m_glWebViewState; } - TilePainter* painter() { return m_painter; } private: void validatePaint(); GLWebViewState* m_glWebViewState; - TilePainter* m_painter; int m_x; int m_y; diff --git a/Source/WebCore/platform/graphics/android/FontAndroid.cpp b/Source/WebCore/platform/graphics/android/FontAndroid.cpp index ef7740c..c8b9488 100644 --- a/Source/WebCore/platform/graphics/android/FontAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/FontAndroid.cpp @@ -88,6 +88,8 @@ static bool setupForText(SkPaint* paint, GraphicsContext* gc, if (!mode) return false; + paint->setVerticalText(font->platformData().orientation() == Vertical); + FloatSize shadowOffset; float shadowBlur; Color shadowColor; @@ -193,8 +195,6 @@ void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font, const GlyphBufferAdvance* adv = glyphBuffer.advances(from); SkAutoSTMalloc<32, SkPoint> storage(numGlyphs), storage2(numGlyphs), storage3(numGlyphs); SkPoint* pos = storage.get(); - SkPoint* vPosBegin = storage2.get(); - SkPoint* vPosEnd = storage3.get(); SkCanvas* canvas = gc->platformContext()->mCanvas; @@ -202,6 +202,9 @@ void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font, point.xy + [width, height, width, height, ...], so we have to convert */ + if (font->platformData().orientation() == Vertical) + y += SkFloatToScalar(font->fontMetrics().floatAscent(IdeographicBaseline) - font->fontMetrics().floatAscent()); + if (EmojiFont::IsAvailable()) { // set filtering, to make scaled images look nice(r) paint.setFilterBitmap(true); @@ -231,27 +234,25 @@ void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font, localCount * sizeof(uint16_t), &pos[localIndex], paint); } else { - bool isVertical = font->platformData().orientation() == Vertical; for (int i = 0; i < numGlyphs; i++) { pos[i].set(x, y); y += SkFloatToScalar(adv[i].height()); - if (isVertical) { - SkScalar myWidth = SkFloatToScalar(adv[i].width()); - vPosBegin[i].set(x + myWidth, y); - vPosEnd[i].set(x + myWidth, y - myWidth); - x += myWidth; - - SkPath path; - path.reset(); - path.moveTo(vPosBegin[i]); - path.lineTo(vPosEnd[i]); - canvas->drawTextOnPath(glyphs + i, 2, path, 0, paint); - } - else - x += SkFloatToScalar(adv[i].width()); + x += SkFloatToScalar(adv[i].width()); } - if (!isVertical) - canvas->drawPosText(glyphs, numGlyphs * sizeof(uint16_t), pos, paint); + + if (font->platformData().orientation() == Vertical) { + canvas->save(); + canvas->rotate(-90); + SkMatrix rotator; + rotator.reset(); + rotator.setRotate(90); + rotator.mapPoints(pos, numGlyphs); + } + + canvas->drawPosText(glyphs, numGlyphs * sizeof(uint16_t), pos, paint); + + if (font->platformData().orientation() == Vertical) + canvas->restore(); } } @@ -1003,14 +1004,14 @@ FloatRect Font::selectionRectForComplexText(const TextRun& run, int glyph = walker.logClusters()[from]; fromX = base + walker.positions()[glyph].x(); fromAdvance = walker.advances()[glyph]; - } else + } else if (!walker.rtl()) from -= numCodePoints; if (toX == -1 && to < numCodePoints) { int glyph = walker.logClusters()[to]; toX = base + walker.positions()[glyph].x(); toAdvance = walker.advances()[glyph]; - } else + } else if (!walker.rtl()) to -= numCodePoints; if (!walker.rtl()) diff --git a/Source/WebCore/platform/graphics/android/PaintTileOperation.cpp b/Source/WebCore/platform/graphics/android/PaintTileOperation.cpp index a79298c..1fcb765 100644 --- a/Source/WebCore/platform/graphics/android/PaintTileOperation.cpp +++ b/Source/WebCore/platform/graphics/android/PaintTileOperation.cpp @@ -67,7 +67,7 @@ bool PaintTileOperation::operator==(const QueuedOperation* operation) void PaintTileOperation::run() { if (m_tile) { - m_tile->paintBitmap(); + m_tile->paintBitmap(m_painter); m_tile->setRepaintPending(false); m_tile = 0; } diff --git a/Source/WebCore/platform/graphics/android/PaintTileOperation.h b/Source/WebCore/platform/graphics/android/PaintTileOperation.h index 4e98287..05825e2 100644 --- a/Source/WebCore/platform/graphics/android/PaintTileOperation.h +++ b/Source/WebCore/platform/graphics/android/PaintTileOperation.h @@ -38,13 +38,13 @@ class ImageTexture; class PaintTileOperation : public QueuedOperation { public: - PaintTileOperation(BaseTile* tile, TilePainter* painter = 0); + PaintTileOperation(BaseTile* tile, TilePainter* painter); virtual ~PaintTileOperation(); virtual bool operator==(const QueuedOperation* operation); virtual void run(); // returns a rendering priority for m_tile, lower values are processed faster virtual int priority(); - TilePainter* painter() { return m_tile->painter(); } + TilePainter* painter() { return m_painter; } float scale() { return m_tile->scale(); } private: diff --git a/Source/WebCore/platform/graphics/android/TiledPage.cpp b/Source/WebCore/platform/graphics/android/TiledPage.cpp index df740e7..afa2014 100644 --- a/Source/WebCore/platform/graphics/android/TiledPage.cpp +++ b/Source/WebCore/platform/graphics/android/TiledPage.cpp @@ -171,7 +171,7 @@ void TiledPage::prepareRow(bool goingLeft, int tilesInRow, int firstTileX, int y currentTile->setGLWebViewState(m_glWebViewState); currentTile->setPage(this); - currentTile->setContents(this, x, y, m_scale); + currentTile->setContents(x, y, m_scale); // TODO: move below (which is largely the same for layers / tiled // page) into prepare() function @@ -183,7 +183,7 @@ void TiledPage::prepareRow(bool goingLeft, int tilesInRow, int firstTileX, int y if (currentTile->backTexture() && currentTile->isDirty() && !currentTile->isRepaintPending()) { - PaintTileOperation *operation = new PaintTileOperation(currentTile); + PaintTileOperation *operation = new PaintTileOperation(currentTile, this); TilesManager::instance()->scheduleOperation(operation); } } diff --git a/Source/WebCore/platform/graphics/android/TiledTexture.cpp b/Source/WebCore/platform/graphics/android/TiledTexture.cpp index 9ce6f6d..039e28c 100644 --- a/Source/WebCore/platform/graphics/android/TiledTexture.cpp +++ b/Source/WebCore/platform/graphics/android/TiledTexture.cpp @@ -168,7 +168,7 @@ void TiledTexture::prepareTile(int x, int y, TilePainter* painter) } ALOGV("preparing tile %p at %d, %d, painter is %p", tile, x, y, painter); - tile->setContents(painter, x, y, m_scale); + tile->setContents(x, y, m_scale); // TODO: move below (which is largely the same for layers / tiled page) into // prepareGL() function diff --git a/Source/WebCore/rendering/RenderFrame.cpp b/Source/WebCore/rendering/RenderFrame.cpp index 4b1444b..0ae6eda 100644 --- a/Source/WebCore/rendering/RenderFrame.cpp +++ b/Source/WebCore/rendering/RenderFrame.cpp @@ -64,7 +64,12 @@ void RenderFrame::layout() { FrameView* view = static_cast<FrameView*>(widget()); RenderView* root = view ? view->frame()->contentRenderer() : 0; + + // Do not expand frames which has zero width or height if (!width() || !height() || !root) { + updateWidgetPosition(); + if (view) + view->layout(); setNeedsLayout(false); return; } @@ -75,14 +80,17 @@ void RenderFrame::layout() return; } - int layoutWidth = width(); + // Update the dimensions to get the correct width and height + updateWidgetPosition(); + if (root->preferredLogicalWidthsDirty()) + root->computePreferredLogicalWidths(); + // Expand the frame by setting frame height = content height setWidth(max(view->contentsWidth() + borderAndPaddingWidth(), width())); setHeight(max(view->contentsHeight() + borderAndPaddingHeight(), height())); - // Trigger a layout of the FrameView which will schedule a relayout of this RenderFrame. - if (layoutWidth < width()) - view->layout(); + // Update one more time + updateWidgetPosition(); setNeedsLayout(false); } |