summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/WebCore/Android.mk1
-rw-r--r--Source/WebCore/loader/FrameLoader.cpp2
-rw-r--r--Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp38
-rw-r--r--Source/WebCore/platform/graphics/android/BaseLayerAndroid.h5
-rw-r--r--Source/WebCore/platform/graphics/android/BaseRenderer.cpp2
-rw-r--r--Source/WebCore/platform/graphics/android/FontAndroid.cpp23
-rw-r--r--Source/WebCore/platform/graphics/android/FontCacheAndroid.cpp4
-rw-r--r--Source/WebCore/platform/graphics/android/FontCustomPlatformData.cpp5
-rw-r--r--Source/WebCore/platform/graphics/android/FontDataAndroid.cpp11
-rw-r--r--Source/WebCore/platform/graphics/android/FontPlatformData.h11
-rw-r--r--Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp28
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.cpp10
-rw-r--r--Source/WebCore/platform/graphics/android/GlyphMapAndroid.cpp72
-rw-r--r--Source/WebCore/platform/graphics/android/ImageBufferAndroid.cpp6
-rw-r--r--Source/WebCore/platform/graphics/android/LayerAndroid.cpp38
-rw-r--r--Source/WebCore/platform/graphics/android/LayerAndroid.h3
-rw-r--r--Source/WebCore/platform/graphics/android/PaintedSurface.cpp13
-rw-r--r--Source/WebCore/platform/graphics/android/PaintedSurface.h1
-rw-r--r--Source/WebCore/platform/graphics/android/TilePainter.h1
-rw-r--r--Source/WebCore/platform/graphics/android/TiledPage.cpp28
-rw-r--r--Source/WebCore/platform/graphics/android/TiledPage.h4
-rw-r--r--Source/WebCore/platform/graphics/android/TiledTexture.cpp5
-rw-r--r--Source/WebCore/platform/graphics/android/TiledTexture.h1
-rw-r--r--Source/WebCore/platform/graphics/android/TilesManager.cpp2
-rw-r--r--Source/WebCore/platform/graphics/android/VerticalTextMap.cpp103
-rw-r--r--Source/WebCore/platform/graphics/android/VerticalTextMap.h44
-rw-r--r--Source/WebCore/rendering/RenderLayer.h2
-rw-r--r--Source/WebKit/android/WebCoreSupport/WebCache.cpp39
-rw-r--r--Source/WebKit/android/nav/CacheBuilder.cpp2
-rw-r--r--Source/WebKit/android/nav/CachedNode.cpp15
-rw-r--r--Source/WebKit/android/nav/CachedNode.h4
-rw-r--r--Source/WebKit/android/nav/SelectText.cpp11
-rw-r--r--Source/WebKit/android/nav/SelectText.h2
-rw-r--r--Source/WebKit/android/nav/WebView.cpp43
34 files changed, 376 insertions, 203 deletions
diff --git a/Source/WebCore/Android.mk b/Source/WebCore/Android.mk
index 5df4d93..a516f48 100644
--- a/Source/WebCore/Android.mk
+++ b/Source/WebCore/Android.mk
@@ -681,6 +681,7 @@ LOCAL_SRC_FILES := $(LOCAL_SRC_FILES) \
platform/graphics/android/TiledTexture.cpp \
platform/graphics/android/TransferQueue.cpp \
platform/graphics/android/UpdateManager.cpp \
+ platform/graphics/android/VerticalTextMap.cpp \
platform/graphics/android/VideoLayerAndroid.cpp \
platform/graphics/android/VideoLayerManager.cpp \
platform/graphics/android/ZoomManager.cpp \
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/BaseLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
index a8c4d7a..2a1b1de 100644
--- a/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
@@ -101,14 +101,6 @@ void BaseLayerAndroid::setContent(const PictureSet& src)
// setSize(src.width(), src.height());
}
-void BaseLayerAndroid::setExtra(SkPicture& src)
-{
-#if USE(ACCELERATED_COMPOSITING)
- android::Mutex::Autolock lock(m_drawLock);
-#endif
- m_extra.swap(src);
-}
-
void BaseLayerAndroid::drawCanvas(SkCanvas* canvas)
{
#if USE(ACCELERATED_COMPOSITING)
@@ -116,15 +108,12 @@ void BaseLayerAndroid::drawCanvas(SkCanvas* canvas)
#endif
if (!m_content.isEmpty())
m_content.draw(canvas);
- // TODO : replace with !m_extra.isEmpty() once such a call exists
- if (m_extra.width() > 0)
- m_extra.draw(canvas);
}
#if USE(ACCELERATED_COMPOSITING)
void BaseLayerAndroid::prefetchBasePicture(SkRect& viewport, float currentScale,
- TiledPage* prefetchTiledPage)
+ TiledPage* prefetchTiledPage, bool draw)
{
SkIRect bounds;
float prefetchScale = currentScale * PREFETCH_SCALE_MODIFIER;
@@ -162,7 +151,8 @@ void BaseLayerAndroid::prefetchBasePicture(SkRect& viewport, float currentScale,
prefetchTiledPage->swapBuffersIfReady(bounds,
prefetchScale,
TiledPage::SwapWhateverIsReady);
- prefetchTiledPage->draw(PREFETCH_OPACITY, bounds);
+ if (draw)
+ prefetchTiledPage->draw(PREFETCH_OPACITY, bounds);
}
bool BaseLayerAndroid::drawBasePictureInGL(SkRect& viewport, float scale,
@@ -235,7 +225,7 @@ bool BaseLayerAndroid::drawBasePictureInGL(SkRect& viewport, float scale,
// When we aren't zooming, we should TRY and swap tile buffers if they're
// ready. When scrolling, we swap whatever's ready. Otherwise, buffer until
// the entire page is ready and then swap.
- bool buffersSwapped = false;
+ bool tilesFinished = false;
if (!zooming) {
TiledPage::SwapMethod swapMethod;
if (scrolling)
@@ -243,13 +233,13 @@ bool BaseLayerAndroid::drawBasePictureInGL(SkRect& viewport, float scale,
else
swapMethod = TiledPage::SwapWholePage;
- buffersSwapped = tiledPage->swapBuffersIfReady(preZoomBounds,
+ tilesFinished = tiledPage->swapBuffersIfReady(preZoomBounds,
zoomManager->currentScale(),
swapMethod);
- if (buffersSwappedPtr && buffersSwapped)
+ if (buffersSwappedPtr && tilesFinished)
*buffersSwappedPtr = true;
- if (buffersSwapped) {
+ if (tilesFinished) {
if (m_scrollState == ScrollingFinishPaint) {
m_scrollState = NotScrolling;
scrolling = false;
@@ -265,7 +255,7 @@ bool BaseLayerAndroid::drawBasePictureInGL(SkRect& viewport, float scale,
}
- bool needsRedraw = scrolling || zooming || !buffersSwapped;
+ bool needsRedraw = scrolling || zooming || !tilesFinished;
// if we don't expect to redraw, unlock the invals
if (!needsRedraw)
@@ -283,15 +273,19 @@ bool BaseLayerAndroid::drawBasePictureInGL(SkRect& viewport, float scale,
TiledPage::ExpandedBounds);
}
- XLOG("scrolling %d, zooming %d, buffersSwapped %d, needsRedraw %d",
- scrolling, zooming, buffersSwapped, needsRedraw);
+ XLOG("scrolling %d, zooming %d, tilesFinished %d, needsRedraw %d",
+ scrolling, zooming, tilesFinished, needsRedraw);
// prefetch in the nextTiledPage if unused by zooming (even if not scrolling
// since we want the tiles to be ready before they're needed)
bool usePrefetchPage = !zooming;
nextTiledPage->setIsPrefetchPage(usePrefetchPage);
- if (usePrefetchPage)
- prefetchBasePicture(viewport, scale, nextTiledPage);
+ if (usePrefetchPage) {
+ // if the non-prefetch page isn't missing tiles, don't bother drawing
+ // prefetch page
+ bool drawPrefetchPage = tiledPage->hasMissingContent(preZoomBounds);
+ prefetchBasePicture(viewport, scale, nextTiledPage, drawPrefetchPage);
+ }
tiledPage->draw(transparency, preZoomBounds);
diff --git a/Source/WebCore/platform/graphics/android/BaseLayerAndroid.h b/Source/WebCore/platform/graphics/android/BaseLayerAndroid.h
index 26fd158..ad77013 100644
--- a/Source/WebCore/platform/graphics/android/BaseLayerAndroid.h
+++ b/Source/WebCore/platform/graphics/android/BaseLayerAndroid.h
@@ -53,7 +53,6 @@ public:
Color getBackgroundColor() { return m_color; }
#endif
void setContent(const android::PictureSet& src);
- void setExtra(SkPicture& extra);
android::PictureSet* content() { return &m_content; }
// This method will paint using the current PictureSet onto
// the passed canvas. We used it to paint the GL tiles as well as
@@ -63,11 +62,10 @@ public:
bool drawGL(double currentTime, LayerAndroid* compositedRoot, IntRect& rect,
SkRect& viewport, float scale, bool* buffersSwappedPtr);
- void swapExtra(BaseLayerAndroid* base) { m_extra.swap(base->m_extra); }
private:
#if USE(ACCELERATED_COMPOSITING)
void prefetchBasePicture(SkRect& viewport, float currentScale,
- TiledPage* prefetchTiledPage);
+ TiledPage* prefetchTiledPage, bool draw);
bool drawBasePictureInGL(SkRect& viewport, float scale, double currentTime,
bool* buffersSwappedPtr);
@@ -76,7 +74,6 @@ private:
Color m_color;
#endif
android::PictureSet m_content;
- SkPicture m_extra;
SkRect m_previousVisible;
ScrollState m_scrollState;
diff --git a/Source/WebCore/platform/graphics/android/BaseRenderer.cpp b/Source/WebCore/platform/graphics/android/BaseRenderer.cpp
index 96599af..57baee8 100644
--- a/Source/WebCore/platform/graphics/android/BaseRenderer.cpp
+++ b/Source/WebCore/platform/graphics/android/BaseRenderer.cpp
@@ -133,8 +133,6 @@ int BaseRenderer::renderTiledContent(const TileRenderInfo& renderInfo)
canvas.scale(renderInfo.scale, renderInfo.scale);
unsigned int pictureCount = 0;
renderInfo.tilePainter->paint(renderInfo.baseTile, &canvas, &pictureCount);
- if (renderInfo.baseTile->isLayerTile())
- renderInfo.tilePainter->paintExtra(&canvas);
if (visualIndicator) {
canvas.restore();
diff --git a/Source/WebCore/platform/graphics/android/FontAndroid.cpp b/Source/WebCore/platform/graphics/android/FontAndroid.cpp
index 6b4296b..3528d47 100644
--- a/Source/WebCore/platform/graphics/android/FontAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/FontAndroid.cpp
@@ -183,8 +183,10 @@ void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font,
SkScalar y = SkFloatToScalar(point.y());
const GlyphBufferGlyph* glyphs = glyphBuffer.glyphs(from);
const GlyphBufferAdvance* adv = glyphBuffer.advances(from);
- SkAutoSTMalloc<32, SkPoint> storage(numGlyphs);
+ 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;
@@ -221,12 +223,27 @@ 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);
- x += SkFloatToScalar(adv[i].width());
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());
}
- canvas->drawPosText(glyphs, numGlyphs * sizeof(uint16_t), pos, paint);
+ if (!isVertical)
+ canvas->drawPosText(glyphs, numGlyphs * sizeof(uint16_t), pos, paint);
}
}
diff --git a/Source/WebCore/platform/graphics/android/FontCacheAndroid.cpp b/Source/WebCore/platform/graphics/android/FontCacheAndroid.cpp
index 20ffd17..4fc3b4e 100644
--- a/Source/WebCore/platform/graphics/android/FontCacheAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/FontCacheAndroid.cpp
@@ -177,7 +177,9 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD
result = new FontPlatformData(tf, fontDescription.computedSize(),
(style & SkTypeface::kBold) && !tf->isBold(),
- (style & SkTypeface::kItalic) && !tf->isItalic());
+ (style & SkTypeface::kItalic) && !tf->isItalic(),
+ fontDescription.orientation(),
+ fontDescription.textOrientation());
}
tf->unref();
diff --git a/Source/WebCore/platform/graphics/android/FontCustomPlatformData.cpp b/Source/WebCore/platform/graphics/android/FontCustomPlatformData.cpp
index 72fac68..693386e 100644
--- a/Source/WebCore/platform/graphics/android/FontCustomPlatformData.cpp
+++ b/Source/WebCore/platform/graphics/android/FontCustomPlatformData.cpp
@@ -45,7 +45,8 @@ FontCustomPlatformData::~FontCustomPlatformData()
// the unref is enough to release the font data...
}
-FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic, FontOrientation, TextOrientation, FontWidthVariant, FontRenderingMode)
+FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, bool italic,
+ FontOrientation fontOrientation, TextOrientation textOrientation, FontWidthVariant, FontRenderingMode)
{
// turn bold/italic into fakeBold/fakeItalic
if (m_typeface != NULL) {
@@ -54,7 +55,7 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(int size, bool bold, b
if (m_typeface->isItalic() == italic)
italic = false;
}
- return FontPlatformData(m_typeface, size, bold, italic);
+ return FontPlatformData(m_typeface, size, bold, italic, fontOrientation, textOrientation);
}
FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
diff --git a/Source/WebCore/platform/graphics/android/FontDataAndroid.cpp b/Source/WebCore/platform/graphics/android/FontDataAndroid.cpp
index 1f19b6d..c6dd174 100644
--- a/Source/WebCore/platform/graphics/android/FontDataAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/FontDataAndroid.cpp
@@ -32,6 +32,7 @@
#include "SimpleFontData.h"
#include "FloatRect.h"
#include "FontDescription.h"
+#include "SkFontHost.h"
#include "SkPaint.h"
#include "SkTypeface.h"
#include "SkTime.h"
@@ -57,6 +58,16 @@ void SimpleFontData::platformInit()
m_fontMetrics.setXHeight(SkScalarToFloat(-skiaFontMetrics.fAscent) * 0.56f); // hack I stole from the window's port
m_fontMetrics.setLineSpacing(a + d);
m_fontMetrics.setLineGap(SkScalarToFloat(skiaFontMetrics.fLeading));
+
+ if (platformData().orientation() == Vertical && !isTextOrientationFallback()) {
+ static const uint32_t vheaTag = SkSetFourByteTag('v', 'h', 'e', 'a');
+ static const uint32_t vorgTag = SkSetFourByteTag('V', 'O', 'R', 'G');
+ const SkFontID fontID = m_platformData.uniqueID();
+ size_t vheaSize = SkFontHost::GetTableSize(fontID, vheaTag);
+ size_t vorgSize = SkFontHost::GetTableSize(fontID, vorgTag);
+ if ((vheaSize > 0) || (vorgSize > 0))
+ m_hasVerticalGlyphs = true;
+ }
}
void SimpleFontData::platformCharWidthInit()
diff --git a/Source/WebCore/platform/graphics/android/FontPlatformData.h b/Source/WebCore/platform/graphics/android/FontPlatformData.h
index 56ce6e9..5c3313e 100644
--- a/Source/WebCore/platform/graphics/android/FontPlatformData.h
+++ b/Source/WebCore/platform/graphics/android/FontPlatformData.h
@@ -31,6 +31,7 @@
#define FontPlatformData_h
#include "FontOrientation.h"
+#include "TextOrientation.h"
#include <wtf/text/StringImpl.h>
#ifndef NDEBUG
@@ -52,7 +53,8 @@ public:
FontPlatformData();
FontPlatformData(const FontPlatformData&);
- FontPlatformData(SkTypeface*, float textSize, bool fakeBold, bool fakeItalic);
+ FontPlatformData(SkTypeface*, float textSize, bool fakeBold, bool fakeItalic,
+ FontOrientation = Horizontal, TextOrientation = TextOrientationVerticalRight);
FontPlatformData(const FontPlatformData& src, float textSize);
FontPlatformData(float size, bool syntheticBold, bool syntheticOblique);
FontPlatformData(const FontPlatformData& src, SkTypeface* typeface);
@@ -65,9 +67,8 @@ public:
return mTypeface == hashTableDeletedFontValue();
}
- FontOrientation orientation() const { return Horizontal; } // FIXME: Implement.
- void setOrientation(FontOrientation) { } // FIXME: Implement.
-
+ FontOrientation orientation() const { return mOrientation; }
+ void setOrientation(FontOrientation orientation) { mOrientation = orientation; }
FontPlatformData& operator=(const FontPlatformData&);
bool operator==(const FontPlatformData& a) const;
@@ -114,6 +115,8 @@ private:
float mTextSize;
bool mFakeBold;
bool mFakeItalic;
+ FontOrientation mOrientation;
+ TextOrientation mTextOrientation;
mutable RefPtr<RefCountedHarfbuzzFace> m_harfbuzzFace;
static SkTypeface* hashTableDeletedFontValue() {
diff --git a/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp b/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp
index 8e77b5b..3c90246 100644
--- a/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp
@@ -74,7 +74,8 @@ FontPlatformData::RefCountedHarfbuzzFace::~RefCountedHarfbuzzFace()
}
FontPlatformData::FontPlatformData()
- : mTypeface(NULL), mTextSize(0), mFakeBold(false), mFakeItalic(false)
+ : mTypeface(NULL), mTextSize(0), mFakeBold(false), mFakeItalic(false),
+ mOrientation(Horizontal), mTextOrientation(TextOrientationVerticalRight)
{
inc_count();
trace(1);
@@ -92,13 +93,17 @@ FontPlatformData::FontPlatformData(const FontPlatformData& src)
mFakeBold = src.mFakeBold;
mFakeItalic = src.mFakeItalic;
m_harfbuzzFace = src.m_harfbuzzFace;
+ mOrientation = src.mOrientation;
+ mTextOrientation = src.mTextOrientation;
inc_count();
trace(2);
}
-FontPlatformData::FontPlatformData(SkTypeface* tf, float textSize, bool fakeBold, bool fakeItalic)
- : mTypeface(tf), mTextSize(textSize), mFakeBold(fakeBold), mFakeItalic(fakeItalic)
+FontPlatformData::FontPlatformData(SkTypeface* tf, float textSize, bool fakeBold, bool fakeItalic,
+ FontOrientation orientation, TextOrientation textOrientation)
+ : mTypeface(tf), mTextSize(textSize), mFakeBold(fakeBold), mFakeItalic(fakeItalic),
+ mOrientation(orientation), mTextOrientation(textOrientation)
{
if (hashTableDeletedFontValue() != mTypeface) {
SkSafeRef(mTypeface);
@@ -110,7 +115,7 @@ FontPlatformData::FontPlatformData(SkTypeface* tf, float textSize, bool fakeBold
FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize)
: mTypeface(src.mTypeface), mTextSize(textSize), mFakeBold(src.mFakeBold), mFakeItalic(src.mFakeItalic),
- m_harfbuzzFace(src.m_harfbuzzFace)
+ m_harfbuzzFace(src.m_harfbuzzFace), mOrientation(src.mOrientation), mTextOrientation(src.mTextOrientation)
{
if (hashTableDeletedFontValue() != mTypeface) {
SkSafeRef(mTypeface);
@@ -121,7 +126,8 @@ FontPlatformData::FontPlatformData(const FontPlatformData& src, float textSize)
}
FontPlatformData::FontPlatformData(float size, bool bold, bool oblique)
- : mTypeface(NULL), mTextSize(size), mFakeBold(bold), mFakeItalic(oblique)
+ : mTypeface(NULL), mTextSize(size), mFakeBold(bold), mFakeItalic(oblique),
+ mOrientation(Horizontal), mTextOrientation(TextOrientationVerticalRight)
{
inc_count();
trace(5);
@@ -129,7 +135,8 @@ FontPlatformData::FontPlatformData(float size, bool bold, bool oblique)
FontPlatformData::FontPlatformData(const FontPlatformData& src, SkTypeface* tf)
: mTypeface(tf), mTextSize(src.mTextSize), mFakeBold(src.mFakeBold),
- mFakeItalic(src.mFakeItalic)
+ mFakeItalic(src.mFakeItalic), mOrientation(src.mOrientation),
+ mTextOrientation(src.mTextOrientation)
{
if (hashTableDeletedFontValue() != mTypeface) {
SkSafeRef(mTypeface);
@@ -165,6 +172,8 @@ FontPlatformData& FontPlatformData::operator=(const FontPlatformData& src)
mFakeBold = src.mFakeBold;
mFakeItalic = src.mFakeItalic;
m_harfbuzzFace = src.m_harfbuzzFace;
+ mOrientation = src.mOrientation;
+ mTextOrientation = src.mTextOrientation;
return *this;
}
@@ -204,7 +213,9 @@ bool FontPlatformData::operator==(const FontPlatformData& a) const
return mTypeface == a.mTypeface &&
mTextSize == a.mTextSize &&
mFakeBold == a.mFakeBold &&
- mFakeItalic == a.mFakeItalic;
+ mFakeItalic == a.mFakeItalic &&
+ mOrientation == a.mOrientation &&
+ mTextOrientation == a.mTextOrientation;
}
unsigned FontPlatformData::hash() const
@@ -219,7 +230,8 @@ unsigned FontPlatformData::hash() const
uint32_t sizeAsInt = *reinterpret_cast<const uint32_t*>(&mTextSize);
- h ^= 0x01010101 * (((int)mFakeBold << 1) | (int)mFakeItalic);
+ h ^= 0x01010101 * ((static_cast<int>(mTextOrientation) << 3) | (static_cast<int>(mOrientation) << 2) |
+ ((int)mFakeBold << 1) | (int)mFakeItalic);
h ^= sizeAsInt;
return h;
}
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
index febc34a..e53a1e1 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -147,8 +147,6 @@ void GLWebViewState::setBaseLayer(BaseLayerAndroid* layer, const SkRegion& inval
m_baseLayerUpdate = true;
m_invalidateRegion.setEmpty();
}
- if (m_currentBaseLayer && layer)
- m_currentBaseLayer->swapExtra(layer);
SkSafeRef(layer);
SkSafeUnref(m_currentBaseLayer);
@@ -309,10 +307,8 @@ void GLWebViewState::setViewport(SkRect& viewport, float scale)
// allocate max possible number of tiles visible with this viewport
int viewMaxTileX = static_cast<int>(ceilf((viewport.width()-1) * invTileContentWidth)) + 1;
int viewMaxTileY = static_cast<int>(ceilf((viewport.height()-1) * invTileContentHeight)) + 1;
-
- // NOTE: fetching 4 viewports worth, may need to be adjusted per-device
int maxTextureCount = (viewMaxTileX + TILE_PREFETCH_DISTANCE * 2) *
- (viewMaxTileY + TILE_PREFETCH_DISTANCE * 2) * 4;
+ (viewMaxTileY + TILE_PREFETCH_DISTANCE * 2) * 2;
TilesManager::instance()->setMaxTextureCount(maxTextureCount);
m_tiledPageA->updateBaseTileSize();
m_tiledPageB->updateBaseTileSize();
@@ -464,8 +460,10 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
// 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)
+ if (scale < MIN_SCALE_WARNING || scale > MAX_SCALE_WARNING) {
XLOGC("WARNING, scale seems corrupted after update: %e", scale);
+ CRASH();
+ }
// gather the textures we can use
TilesManager::instance()->gatherLayerTextures();
diff --git a/Source/WebCore/platform/graphics/android/GlyphMapAndroid.cpp b/Source/WebCore/platform/graphics/android/GlyphMapAndroid.cpp
index da9d99a..a327b79 100644
--- a/Source/WebCore/platform/graphics/android/GlyphMapAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/GlyphMapAndroid.cpp
@@ -27,17 +27,52 @@
#include "config.h"
#include "EmojiFont.h"
+#include "Font.h"
#include "GlyphPageTreeNode.h"
-#include "SkTemplates.h"
+#include "HarfbuzzSkia.h"
+#include "SimpleFontData.h"
+#include "SkFontHost.h"
#include "SkPaint.h"
+#include "SkTemplates.h"
#include "SkUtils.h"
-#include "SimpleFontData.h"
+#include "VerticalTextMap.h"
+
using namespace android;
namespace WebCore {
-#define NO_BREAK_SPACE_UNICHAR 0xA0
+#define NO_BREAK_SPACE_UNICHAR 0xA0
+
+static int substituteWithVerticalGlyphs(const FontPlatformData& platformData, uint16_t* glyphs, unsigned bufferLength)
+{
+ HB_FaceRec_* hbFace = platformData.harfbuzzFace();
+ if (!hbFace->gsub) {
+ // if there is no GSUB table, treat it as not covered
+ return 0Xffff;
+ }
+
+ HB_Buffer buffer;
+ hb_buffer_new(&buffer);
+ for (unsigned i = 0; i < bufferLength; ++i)
+ hb_buffer_add_glyph(buffer, glyphs[i], 0, i);
+
+ HB_UShort scriptIndex;
+ HB_UShort featureIndex;
+
+ HB_GSUB_Select_Script(hbFace->gsub, HB_MAKE_TAG('D', 'F', 'L', 'T'), &scriptIndex);
+ HB_GSUB_Select_Feature(hbFace->gsub, HB_MAKE_TAG('v', 'e', 'r', 't'), scriptIndex, 0xffff, &featureIndex);
+ HB_GSUB_Add_Feature(hbFace->gsub, featureIndex, 1);
+ HB_GSUB_Select_Feature(hbFace->gsub, HB_MAKE_TAG('v', 'r', 't', '2'), scriptIndex, 0xffff, &featureIndex);
+ HB_GSUB_Add_Feature(hbFace->gsub, featureIndex, 1);
+
+ int error = HB_GSUB_Apply_String(hbFace->gsub, buffer);
+ if (!error) {
+ for (unsigned i = 0; i < bufferLength; ++i)
+ glyphs[i] = static_cast<Glyph>(buffer->out_string[i].gindex);
+ }
+ return error;
+}
bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData* fontData)
{
@@ -49,21 +84,46 @@ bool GlyphPage::fill(unsigned offset, unsigned length, UChar* buffer, unsigned b
SkPaint paint;
fontData->platformData().setupPaint(&paint);
paint.setTextEncoding(SkPaint::kUTF16_TextEncoding);
-
+
SkAutoSTMalloc <GlyphPage::size, uint16_t> glyphStorage(length);
uint16_t* glyphs = glyphStorage.get();
- unsigned count = paint.textToGlyphs(buffer, bufferLength << 1, glyphs);
+ UChar *textBuffer = buffer;
+ UChar vTextBuffer[bufferLength];
+
+ if (fontData->platformData().orientation() == Vertical && !fontData->hasVerticalGlyphs()) {
+ // Convert to vertical form if there is no vertical glyphs.
+ for (unsigned i = 0; i < bufferLength; ++i) {
+ vTextBuffer[i] = VerticalTextMap::getVerticalForm(buffer[i]);
+ if (!vTextBuffer[i])
+ vTextBuffer[i] = buffer[i];
+ }
+ textBuffer = vTextBuffer;
+ }
+
+ unsigned count = paint.textToGlyphs(textBuffer, bufferLength << 1, glyphs);
if (count != length) {
SkDebugf("%s count != length\n", __FUNCTION__);
return false;
}
+ if (fontData->hasVerticalGlyphs()) {
+ bool lookVariants = false;
+ for (unsigned i = 0; i < bufferLength; ++i) {
+ if (!Font::isCJKIdeograph(textBuffer[i])) {
+ lookVariants = true;
+ continue;
+ }
+ }
+ if (lookVariants)
+ substituteWithVerticalGlyphs(fontData->platformData(), glyphs, bufferLength);
+ }
+
unsigned allGlyphs = 0; // track if any of the glyphIDs are non-zero
// search for emoji. If we knew for sure that buffer was a contiguous range
// of chars, we could quick-reject the range to avoid this loop (usually)
if (EmojiFont::IsAvailable()) {
- const UChar* curr = buffer;
+ const UChar* curr = textBuffer;
for (unsigned i = 0; i < length; i++) {
SkUnichar uni = SkUTF16_NextUnichar(&curr);
uint16_t glyphID = glyphs[i];
diff --git a/Source/WebCore/platform/graphics/android/ImageBufferAndroid.cpp b/Source/WebCore/platform/graphics/android/ImageBufferAndroid.cpp
index bbde998..691fbca 100644
--- a/Source/WebCore/platform/graphics/android/ImageBufferAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/ImageBufferAndroid.cpp
@@ -85,11 +85,9 @@ PassRefPtr<Image> ImageBuffer::copyImage() const
SkDevice* device = canvas->getDevice();
const SkBitmap& orig = device->accessBitmap(false);
- if (!PlatformBridge::canSatisfyMemoryAllocation(orig.getSize()))
- return 0;
-
SkBitmap copy;
- orig.copyTo(&copy, orig.config());
+ if (PlatformBridge::canSatisfyMemoryAllocation(orig.getSize()))
+ orig.copyTo(&copy, orig.config());
SkBitmapRef* ref = new SkBitmapRef(copy);
RefPtr<Image> image = BitmapImage::create(ref, 0);
diff --git a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp
index d4a1225..e0898e6 100644
--- a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp
@@ -66,7 +66,6 @@ LayerAndroid::LayerAndroid(RenderLayer* owner) : Layer(),
m_preserves3D(false),
m_anchorPointZ(0),
m_recordingPicture(0),
- m_extra(0),
m_uniqueId(++gUniqueId),
m_texture(0),
m_imageRef(0),
@@ -93,7 +92,6 @@ LayerAndroid::LayerAndroid(RenderLayer* owner) : Layer(),
LayerAndroid::LayerAndroid(const LayerAndroid& layer) : Layer(layer),
m_haveClip(layer.m_haveClip),
m_isIframe(layer.m_isIframe),
- m_extra(0), // deliberately not copied
m_uniqueId(layer.m_uniqueId),
m_texture(0),
m_imageTexture(0),
@@ -154,7 +152,6 @@ LayerAndroid::LayerAndroid(SkPicture* picture) : Layer(),
m_isFixed(false),
m_isIframe(false),
m_recordingPicture(picture),
- m_extra(0),
m_uniqueId(-1),
m_texture(0),
m_imageRef(0),
@@ -180,7 +177,6 @@ LayerAndroid::~LayerAndroid()
{
if (m_imageTexture)
ImagesManager::instance()->removeImage(m_imageTexture->imageRef());
- delete m_extra;
SkSafeUnref(m_recordingPicture);
m_animations.clear();
#ifdef DEBUG_COUNT
@@ -929,14 +925,6 @@ bool LayerAndroid::drawChildrenGL(GLWebViewState* glWebViewState, SkMatrix& matr
return askScreenUpdate;
}
-void LayerAndroid::extraDraw(SkCanvas* canvas)
-{
- m_atomicSync.lock();
- if (m_extra)
- canvas->drawPicture(*m_extra);
- m_atomicSync.unlock();
-}
-
void LayerAndroid::contentDraw(SkCanvas* canvas)
{
if (m_recordingPicture)
@@ -1230,32 +1218,6 @@ LayerAndroid* LayerAndroid::findById(int match)
return 0;
}
-void LayerAndroid::setExtra(DrawExtra* extra)
-{
- for (int i = 0; i < countChildren(); i++)
- getChild(i)->setExtra(extra);
-
- android::AutoMutex lock(m_atomicSync);
- if (extra || (m_extra && !extra))
- m_dirty = true;
-
- delete m_extra;
- m_extra = 0;
-
- if (!extra)
- return;
-
- if (m_recordingPicture) {
- IntRect dummy; // inval area, unused for now
- m_extra = new SkPicture();
- SkCanvas* canvas = m_extra->beginRecording(m_recordingPicture->width(),
- m_recordingPicture->height());
- extra->draw(canvas, this, &dummy);
- m_extra->endRecording();
- needsRepaint();
- }
-}
-
} // namespace WebCore
#endif // USE(ACCELERATED_COMPOSITING)
diff --git a/Source/WebCore/platform/graphics/android/LayerAndroid.h b/Source/WebCore/platform/graphics/android/LayerAndroid.h
index 4458a2c..15a581e 100644
--- a/Source/WebCore/platform/graphics/android/LayerAndroid.h
+++ b/Source/WebCore/platform/graphics/android/LayerAndroid.h
@@ -233,7 +233,6 @@ public:
{
return static_cast<LayerAndroid*>(this->INHERITED::getChild(index));
}
- void setExtra(DrawExtra* extra); // does not assign ownership
int uniqueId() const { return m_uniqueId; }
bool isFixed() { return m_isFixed; }
@@ -257,7 +256,6 @@ public:
const SkRegion& dirtyRegion() { return m_dirtyRegion; }
void contentDraw(SkCanvas*);
- void extraDraw(SkCanvas*);
virtual bool isMedia() const { return false; }
virtual bool isVideo() const { return false; }
@@ -357,7 +355,6 @@ private:
FloatRect m_clippingRect;
- SkPicture* m_extra;
int m_uniqueId;
PaintedSurface* m_texture;
diff --git a/Source/WebCore/platform/graphics/android/PaintedSurface.cpp b/Source/WebCore/platform/graphics/android/PaintedSurface.cpp
index 8f78638..c0597a9 100644
--- a/Source/WebCore/platform/graphics/android/PaintedSurface.cpp
+++ b/Source/WebCore/platform/graphics/android/PaintedSurface.cpp
@@ -179,19 +179,6 @@ void PaintedSurface::markAsDirty(const SkRegion& dirtyArea)
m_updateManager.updateInval(dirtyArea);
}
-void PaintedSurface::paintExtra(SkCanvas* canvas)
-{
- m_layerLock.lock();
- LayerAndroid* layer = m_layer;
- SkSafeRef(layer);
- m_layerLock.unlock();
-
- if (layer)
- layer->extraDraw(canvas);
-
- SkSafeUnref(layer);
-}
-
float PaintedSurface::opacity() {
if (m_layer)
return m_layer->drawOpacity();
diff --git a/Source/WebCore/platform/graphics/android/PaintedSurface.h b/Source/WebCore/platform/graphics/android/PaintedSurface.h
index 761be74..2e01b80 100644
--- a/Source/WebCore/platform/graphics/android/PaintedSurface.h
+++ b/Source/WebCore/platform/graphics/android/PaintedSurface.h
@@ -66,7 +66,6 @@ public:
void computeVisibleArea();
// TilePainter methods for TiledTexture
- virtual void paintExtra(SkCanvas*);
virtual const TransformationMatrix* transform();
// used by TiledTexture
diff --git a/Source/WebCore/platform/graphics/android/TilePainter.h b/Source/WebCore/platform/graphics/android/TilePainter.h
index 191edf3..91030cb 100644
--- a/Source/WebCore/platform/graphics/android/TilePainter.h
+++ b/Source/WebCore/platform/graphics/android/TilePainter.h
@@ -38,7 +38,6 @@ class TilePainter {
public:
virtual ~TilePainter() { }
virtual bool paint(BaseTile* tile, SkCanvas*, unsigned int*) = 0;
- virtual void paintExtra(SkCanvas*) = 0;
virtual const TransformationMatrix* transform() { return 0; }
};
diff --git a/Source/WebCore/platform/graphics/android/TiledPage.cpp b/Source/WebCore/platform/graphics/android/TiledPage.cpp
index b3b4daf..c097c58 100644
--- a/Source/WebCore/platform/graphics/android/TiledPage.cpp
+++ b/Source/WebCore/platform/graphics/android/TiledPage.cpp
@@ -290,6 +290,19 @@ void TiledPage::prepare(bool goingDown, bool goingLeft, const SkIRect& tileBound
m_prepare = true;
}
+bool TiledPage::hasMissingContent(const SkIRect& tileBounds)
+{
+ int neededTiles = tileBounds.width() * tileBounds.height();
+ for (int j = 0; j < m_baseTileSize; j++) {
+ BaseTile& tile = m_baseTiles[j];
+ if (tileBounds.contains(tile.x(), tile.y())) {
+ if (tile.frontTexture())
+ neededTiles--;
+ }
+ }
+ return neededTiles > 0;
+}
+
bool TiledPage::swapBuffersIfReady(const SkIRect& tileBounds, float scale, SwapMethod swap)
{
if (!m_glWebViewState)
@@ -342,18 +355,9 @@ void TiledPage::draw(float transparency, const SkIRect& tileBounds)
const float tileWidth = TilesManager::tileWidth() * m_invScale;
const float tileHeight = TilesManager::tileHeight() * m_invScale;
- SkIRect actualTileBounds = tileBounds;
- actualTileBounds.fTop -= m_glWebViewState->expandedTileBoundsY();
- actualTileBounds.fBottom += m_glWebViewState->expandedTileBoundsY();
- actualTileBounds.fLeft -= m_glWebViewState->expandedTileBoundsX();
- actualTileBounds.fRight += m_glWebViewState->expandedTileBoundsX();
-
- actualTileBounds.fTop = std::max(0, actualTileBounds.fTop);
- actualTileBounds.fLeft = std::max(0, actualTileBounds.fLeft);
-
for (int j = 0; j < m_baseTileSize; j++) {
BaseTile& tile = m_baseTiles[j];
- bool tileInView = actualTileBounds.contains(tile.x(), tile.y());
+ bool tileInView = tileBounds.contains(tile.x(), tile.y());
if (tileInView) {
SkRect rect;
rect.fLeft = tile.x() * tileWidth;
@@ -383,10 +387,6 @@ bool TiledPage::paint(BaseTile* tile, SkCanvas* canvas, unsigned int* pictureUse
return true;
}
-void TiledPage::paintExtra(SkCanvas* canvas)
-{
-}
-
TiledPage* TiledPage::sibling()
{
if (!m_glWebViewState)
diff --git a/Source/WebCore/platform/graphics/android/TiledPage.h b/Source/WebCore/platform/graphics/android/TiledPage.h
index 718908d..960f3d5 100644
--- a/Source/WebCore/platform/graphics/android/TiledPage.h
+++ b/Source/WebCore/platform/graphics/android/TiledPage.h
@@ -73,7 +73,8 @@ public:
// dirty (and thus repaint needed)
bool updateTileDirtiness(const SkIRect& tileBounds);
- // check to see if the page is ready for display
+ // returns true if the page can't draw the entire region (may still be stale)
+ bool hasMissingContent(const SkIRect& tileBounds);
// swap 'buffers' by swapping each modified texture
bool swapBuffersIfReady(const SkIRect& tileBounds, float scale, SwapMethod swap);
@@ -83,7 +84,6 @@ public:
// TilePainter implementation
// used by individual tiles to generate the bitmap for their tile
bool paint(BaseTile*, SkCanvas*, unsigned int*);
- void paintExtra(SkCanvas*);
// used by individual tiles to get the information about the current picture
GLWebViewState* glWebViewState() { return m_glWebViewState; }
diff --git a/Source/WebCore/platform/graphics/android/TiledTexture.cpp b/Source/WebCore/platform/graphics/android/TiledTexture.cpp
index 3182eef..b252303 100644
--- a/Source/WebCore/platform/graphics/android/TiledTexture.cpp
+++ b/Source/WebCore/platform/graphics/android/TiledTexture.cpp
@@ -257,11 +257,6 @@ bool TiledTexture::paint(BaseTile* tile, SkCanvas* canvas, unsigned int* picture
return m_updateManager.paint(tile, canvas, pictureUsed);
}
-void TiledTexture::paintExtra(SkCanvas* canvas)
-{
- m_surface->paintExtra(canvas);
-}
-
const TransformationMatrix* TiledTexture::transform()
{
return m_surface->transform();
diff --git a/Source/WebCore/platform/graphics/android/TiledTexture.h b/Source/WebCore/platform/graphics/android/TiledTexture.h
index 206961b..c6e9e09 100644
--- a/Source/WebCore/platform/graphics/android/TiledTexture.h
+++ b/Source/WebCore/platform/graphics/android/TiledTexture.h
@@ -80,7 +80,6 @@ public:
// TilePainter methods
bool paint(BaseTile* tile, SkCanvas*, unsigned int*);
- virtual void paintExtra(SkCanvas*);
virtual const TransformationMatrix* transform();
float scale() { return m_scale; }
diff --git a/Source/WebCore/platform/graphics/android/TilesManager.cpp b/Source/WebCore/platform/graphics/android/TilesManager.cpp
index f56c443..dd2b169 100644
--- a/Source/WebCore/platform/graphics/android/TilesManager.cpp
+++ b/Source/WebCore/platform/graphics/android/TilesManager.cpp
@@ -69,7 +69,7 @@
// number to cap the layer tile texturs, it worked on both phones and tablets.
// TODO: after merge the pool of base tiles and layer tiles, we should revisit
// the logic of allocation management.
-#define MAX_TEXTURE_ALLOCATION ((6+TILE_PREFETCH_DISTANCE*2)*(5+TILE_PREFETCH_DISTANCE*2)*4)
+#define MAX_TEXTURE_ALLOCATION ((6+TILE_PREFETCH_DISTANCE*2)*(5+TILE_PREFETCH_DISTANCE*2)*2)
#define TILE_WIDTH 256
#define TILE_HEIGHT 256
#define LAYER_TILE_WIDTH 256
diff --git a/Source/WebCore/platform/graphics/android/VerticalTextMap.cpp b/Source/WebCore/platform/graphics/android/VerticalTextMap.cpp
new file mode 100644
index 0000000..6e715e2
--- /dev/null
+++ b/Source/WebCore/platform/graphics/android/VerticalTextMap.cpp
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2011, 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 AND CONTRIBUTORS
+ * "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 "VerticalTextMap.h"
+
+#include <wtf/Forward.h>
+#include <wtf/MessageQueue.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+static const UChar vTextCnvTable[][2] = {
+ // TODO: uncomment mappings once we add glyphs for vertical forms.
+ // {0x0021, 0xfe15}, // exclamation mark
+ {0x0028, 0xfe35}, // left paren
+ {0x0029, 0xfe36}, // right paren
+ // {0x002c, 0xfe10}, // comma
+ {0x003a, 0xfe30}, // colon
+ {0x003b, 0x007c}, // hyphen
+ // {0x003f, 0xfe16}, // question mark
+ // {0x005b, 0xfe14}, // semicolon
+ {0x005d, 0xfe47}, // left square bracket
+ {0x005f, 0xfe48}, // right square bracket
+ {0x007b, 0xfe37}, // left curly bracket
+ {0x007d, 0xfe38}, // right curly bracket
+ {0x007e, 0x007c}, // tilde to vertical line
+ {0x2013, 0xfe32}, // en dash
+ {0x2014, 0xfe31}, // em dash
+ {0x2015, 0xfe31}, // horizontal bar
+ {0x2025, 0xfe30}, // two dot leader
+ // TODO: change the mapping 0x2026 -> 0xFE19 once Android has the glyph for 0xFE19.
+ {0x2026, 0xfe30}, // three dot leader
+ // {0x3001, 0xfe11}, // Ideographic comma
+ // {0x3002, 0xfe12}, // Ideographic full stop
+ {0x3008, 0xfe3f}, // left angle bracket
+ {0x3009, 0xfe40}, // right angle bracket
+ {0x300a, 0xfe3d}, // left double angle bracket
+ {0x300b, 0xfe3e}, // right double angle bracket
+ {0x300c, 0xfe41}, // left corner bracket
+ {0x300d, 0xfe42}, // right corner bracket
+ {0x300e, 0xfe43}, // left white corner bracket
+ {0x300f, 0xfe44}, // right white corner bracket
+ {0x3010, 0xfe3b}, // left black lenticular bracket
+ {0x3011, 0xfe3c}, // right black lenticular bracket
+ {0x3014, 0xfe39}, // left black lenticular bracket
+ {0x3015, 0xfe3a}, // right tortise shell bracket
+ // {0x3016, 0xfe17}, // left white lenticular bracket
+ // {0x3017, 0xfe18}, // right white lenticular bracket
+ // {0x3019, 0xfe19}, // horizontal ellipses
+ {0x30fc, 0x3021}, // prolonged sound
+ {0xfe4f, 0xfe34}, // wavy low line
+ {0xff08, 0xfe35}, // full width left paren
+ {0xff09, 0xfe36}, // full width right paren
+ {0xff3b, 0xfe47}, // full width left square bracket
+ {0xff3d, 0xfe48}, // full width right square bracket
+ {0xff5b, 0xfe37}, // full width left curly bracket
+ {0xff5d, 0xfe38}, // full width right curly bracket
+ // {0xff64, 0xfe11}, // halfwidth ideo comma
+ // {0xff61, 0xfe12}, // halfwidth ideo full stop
+};
+
+namespace WebCore {
+
+static WTF::Mutex verticalTextHashMapMutex;
+static HashMap<UChar, UChar>* verticalTextHashMap = 0;
+
+UChar VerticalTextMap::getVerticalForm(UChar c) {
+ {
+ MutexLocker lock(verticalTextHashMapMutex);
+ if (!verticalTextHashMap) {
+ // Lazy initialization.
+ verticalTextHashMap = new HashMap<UChar, UChar>;
+ for (size_t i = 0; i < WTF_ARRAY_LENGTH(vTextCnvTable); ++i)
+ verticalTextHashMap->set(vTextCnvTable[i][0], vTextCnvTable[i][1]);
+ }
+ }
+ return verticalTextHashMap->get(c);
+}
+
+}
diff --git a/Source/WebCore/platform/graphics/android/VerticalTextMap.h b/Source/WebCore/platform/graphics/android/VerticalTextMap.h
new file mode 100644
index 0000000..2955589
--- /dev/null
+++ b/Source/WebCore/platform/graphics/android/VerticalTextMap.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2011, 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 AND CONTRIBUTORS
+ * "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.
+ */
+
+#ifndef android_VerticalTextMap_DEFINED
+#define android_VerticalTextMap_DEFINED
+
+#include "WebViewCore.h"
+#include <wtf/StdLibExtras.h>
+#include <wtf/HashMap.h>
+#include <wtf/unicode/CharacterNames.h>
+
+namespace WebCore {
+class VerticalTextMap {
+public:
+ // This function converts given char to its corresponding vertical form.
+ // Rerturns 0 if there is no vertical form.
+ static UChar getVerticalForm(UChar c);
+};
+}
+
+#endif
diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h
index f257593..02ab8e9 100644
--- a/Source/WebCore/rendering/RenderLayer.h
+++ b/Source/WebCore/rendering/RenderLayer.h
@@ -354,7 +354,7 @@ public:
if (hasOverflowScroll())
return true;
#endif
- return !hasAutoZIndex() || renderer()->isRenderView() || (isComposited() && isFixed()) || m_shouldComposite;
+ return !hasAutoZIndex() || renderer()->isRenderView() || (isComposited() && isFixed());
}
#else
#if ENABLE(ANDROID_OVERFLOW_SCROLL)
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(),
diff --git a/Source/WebKit/android/nav/CacheBuilder.cpp b/Source/WebKit/android/nav/CacheBuilder.cpp
index a4bc758..623d2cb 100644
--- a/Source/WebKit/android/nav/CacheBuilder.cpp
+++ b/Source/WebKit/android/nav/CacheBuilder.cpp
@@ -1406,7 +1406,6 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
else if (cachedNode.clip(clip) == false)
continue; // skip this node if outside of the clip
}
- cachedNode.setNavableRects();
cachedNode.setColorIndex(colorIndex);
cachedNode.setExport(exported);
cachedNode.setHasCursorRing(hasCursorRing);
@@ -1478,7 +1477,6 @@ bool CacheBuilder::CleanUpContainedNodes(CachedRoot* cachedRoot,
lastNode->hasTagName(HTMLNames::formTag)) {
lastCached->setBounds(IntRect(0, 0, 0, 0));
lastCached->mCursorRing.clear();
- lastCached->setNavableRects();
return false;
}
CachedNode* onlyChildCached = cachedFrame->lastNode();
diff --git a/Source/WebKit/android/nav/CachedNode.cpp b/Source/WebKit/android/nav/CachedNode.cpp
index 86c2a38..e500875 100644
--- a/Source/WebKit/android/nav/CachedNode.cpp
+++ b/Source/WebKit/android/nav/CachedNode.cpp
@@ -92,10 +92,9 @@ void CachedNode::cursorRings(const CachedFrame* frame,
WebCore::IntRect CachedNode::cursorRingBounds(const CachedFrame* frame) const
{
- int partMax = mNavableRects;
- ASSERT(partMax > 0);
- WebCore::IntRect bounds = mCursorRing[0];
- for (int partIndex = 1; partIndex < partMax; partIndex++)
+ int partMax = navableRects();
+ WebCore::IntRect bounds;
+ for (int partIndex = 0; partIndex < partMax; partIndex++)
bounds.unite(mCursorRing[partIndex]);
bounds.inflate(CURSOR_RING_HIT_TEST_RADIUS);
return mIsInLayer ? frame->adjustBounds(this, bounds) : bounds;
@@ -116,7 +115,7 @@ void CachedNode::fixUpCursorRects(const CachedFrame* frame)
mUseHitBounds = true;
return;
}
- if (mNavableRects <= 1)
+ if (navableRects() <= 1)
return;
// if there is more than 1 rect, and the bounds doesn't intersect
// any other cursor ring bounds, use it
@@ -290,8 +289,8 @@ void CachedNode::move(int x, int y)
bool CachedNode::partRectsContains(const CachedNode* other) const
{
int outerIndex = 0;
- int outerMax = mNavableRects;
- int innerMax = other->mNavableRects;
+ int outerMax = navableRects();
+ int innerMax = other->navableRects();
do {
const WebCore::IntRect& outerBounds = mCursorRing[outerIndex];
int innerIndex = 0;
@@ -403,7 +402,7 @@ void CachedNode::Debug::print() const
DUMP_NAV_LOGD("// void* mParentGroup=%p; // (%d) \n", b->mParentGroup, mParentGroupIndex);
DUMP_NAV_LOGD("// int mDataIndex=%d;\n", b->mDataIndex);
DUMP_NAV_LOGD("// int mIndex=%d;\n", b->mIndex);
- DUMP_NAV_LOGD("// int mNavableRects=%d;\n", b->mNavableRects);
+ DUMP_NAV_LOGD("// int navableRects()=%d;\n", b->navableRects());
DUMP_NAV_LOGD("// int mParentIndex=%d;\n", b->mParentIndex);
DUMP_NAV_LOGD("// int mTabIndex=%d;\n", b->mTabIndex);
DUMP_NAV_LOGD("// int mColorIndex=%d;\n", b->mColorIndex);
diff --git a/Source/WebKit/android/nav/CachedNode.h b/Source/WebKit/android/nav/CachedNode.h
index 602dda6..321b7fd 100644
--- a/Source/WebKit/android/nav/CachedNode.h
+++ b/Source/WebKit/android/nav/CachedNode.h
@@ -136,7 +136,7 @@ public:
WebCore::IntRect localHitBounds(const CachedFrame* ) const;
WebCore::IntRect localRing(const CachedFrame* , size_t part) const;
void move(int x, int y);
- int navableRects() const { return mNavableRects; }
+ int navableRects() const { return mCursorRing.size(); }
void* nodePointer() const { return mNode; }
bool noSecondChance() const { return mCondition > SECOND_CHANCE_END; }
const WebCore::IntRect& originalAbsoluteBounds() const {
@@ -169,7 +169,6 @@ public:
void setIsTransparent(bool isTransparent) { mIsTransparent = isTransparent; }
void setIsUnclipped(bool unclipped) { mIsUnclipped = unclipped; }
void setLast() { mLast = true; }
- void setNavableRects() { mNavableRects = mCursorRing.size(); }
void setParentGroup(void* group) { mParentGroup = group; }
void setParentIndex(int parent) { mParentIndex = parent; }
void setSingleImage(bool single) { mSingleImage = single; }
@@ -195,7 +194,6 @@ private:
void* mParentGroup; // WebCore::Node*, only used to match pointers
int mDataIndex; // child frame if a frame; input data index; or -1
int mIndex; // index of itself, to find first in array (document)
- int mNavableRects; // FIXME: could be bitfield once I limit max number of rects
int mParentIndex;
int mTabIndex;
int mColorIndex; // index to ring color and other stylable properties
diff --git a/Source/WebKit/android/nav/SelectText.cpp b/Source/WebKit/android/nav/SelectText.cpp
index 8427e6f..98ec574 100644
--- a/Source/WebKit/android/nav/SelectText.cpp
+++ b/Source/WebKit/android/nav/SelectText.cpp
@@ -1478,7 +1478,8 @@ static void addEnd(SkRegion* diff, const SkIRect& rect)
diff->op(bounds, SkRegion::kUnion_Op);
}
-void SelectText::getSelectionRegion(const IntRect& vis, SkRegion *region)
+void SelectText::getSelectionRegion(const IntRect& vis, SkRegion *region,
+ LayerAndroid* root)
{
SkIRect ivisBounds = vis;
ivisBounds.join(m_selStart);
@@ -1486,6 +1487,14 @@ void SelectText::getSelectionRegion(const IntRect& vis, SkRegion *region)
region->setEmpty();
buildSelection(*m_picture, ivisBounds, m_selStart, m_startBase,
m_selEnd, m_endBase, region);
+ if (root && m_layerId) {
+ Layer* layer = root->findById(m_layerId);
+ while (layer) {
+ const SkPoint& pos = layer->getPosition();
+ region->translate(pos.fX, pos.fY);
+ layer = layer->getParent();
+ }
+ }
}
void SelectText::drawSelectionRegion(SkCanvas* canvas, IntRect* inval)
diff --git a/Source/WebKit/android/nav/SelectText.h b/Source/WebKit/android/nav/SelectText.h
index b1e1f11..e5f7f59 100644
--- a/Source/WebKit/android/nav/SelectText.h
+++ b/Source/WebKit/android/nav/SelectText.h
@@ -57,7 +57,7 @@ public:
void setExtendSelection(bool extend) { m_extendSelection = extend; }
bool startSelection(const CachedRoot* , const IntRect& vis, int x, int y);
bool wordSelection(const CachedRoot* , const IntRect& vis, int x, int y);
- void getSelectionRegion(const IntRect& vis, SkRegion *region);
+ void getSelectionRegion(const IntRect& vis, SkRegion *region, LayerAndroid* root);
void updateHandleScale(float handleScale);
public:
float m_inverseScale; // inverse scale, x, y used for drawing select path
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index 0876db6..46f608b 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -420,7 +420,7 @@ void scrollRectOnScreen(const IntRect& rect)
{
if (rect.isEmpty())
return;
- SkRect visible;
+ SkRect visible = SkRect::MakeEmpty();
calcOurContentVisibleRect(&visible);
int dx = 0;
int left = rect.x();
@@ -572,10 +572,6 @@ bool drawGL(WebCore::IntRect& viewRect, WebCore::IntRect* invalRect, WebCore::In
unsigned int pic = m_glWebViewState->currentPictureCounter();
m_glWebViewState->glExtras()->setDrawExtra(extra);
- LayerAndroid* compositeLayer = compositeRoot();
- if (compositeLayer)
- compositeLayer->setExtra(0);
-
SkRect visibleRect;
calcOurContentVisibleRect(&visibleRect);
// Make sure we have valid coordinates. We might not have valid coords
@@ -650,28 +646,27 @@ PictureSet* draw(SkCanvas* canvas, SkColor bgColor, int extras, bool split)
default:
;
}
+#if USE(ACCELERATED_COMPOSITING)
+ LayerAndroid* compositeLayer = compositeRoot();
+ if (compositeLayer) {
+ SkRect visible;
+ calcOurContentVisibleRect(&visible);
+ // call this to be sure we've adjusted for any scrolling or animations
+ // before we actually draw
+ compositeLayer->updateFixedLayersPositions(visible);
+ compositeLayer->updatePositions();
+ // We have to set the canvas' matrix on the base layer
+ // (to have fixed layers work as intended)
+ SkAutoCanvasRestore restore(canvas, true);
+ m_baseLayer->setMatrix(canvas->getTotalMatrix());
+ canvas->resetMatrix();
+ m_baseLayer->draw(canvas);
+ }
+#endif
if (extra) {
IntRect dummy; // inval area, unused for now
extra->draw(canvas, &mainPicture, &dummy);
}
-#if USE(ACCELERATED_COMPOSITING)
- LayerAndroid* compositeLayer = compositeRoot();
- if (!compositeLayer)
- return ret;
- compositeLayer->setExtra(extra);
- SkRect visible;
- calcOurContentVisibleRect(&visible);
- // call this to be sure we've adjusted for any scrolling or animations
- // before we actually draw
- compositeLayer->updateFixedLayersPositions(visible);
- compositeLayer->updatePositions();
- // We have to set the canvas' matrix on the base layer
- // (to have fixed layers work as intended)
- SkAutoCanvasRestore restore(canvas, true);
- m_baseLayer->setMatrix(canvas->getTotalMatrix());
- canvas->resetMatrix();
- m_baseLayer->draw(canvas);
-#endif
return ret;
}
@@ -1557,7 +1552,7 @@ void setBaseLayer(BaseLayerAndroid* layer, SkRegion& inval, bool showVisualIndic
void getTextSelectionRegion(SkRegion *region)
{
- m_selectText.getSelectionRegion(getVisibleRect(), region);
+ m_selectText.getSelectionRegion(getVisibleRect(), region, compositeRoot());
}
void replaceBaseContent(PictureSet* set)