diff options
author | John Reck <jreck@google.com> | 2011-10-06 16:17:19 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-10-07 12:13:10 -0700 |
commit | fcb01cd64de0a1d6f8f8c897d16cc2628be53960 (patch) | |
tree | 587cb1b571b2889012e8e477b82211a1ace8e119 /Source/WebKit | |
parent | 4a7bb352bfa0e515586d929c9528bc6e3a4ca0da (diff) | |
download | external_webkit-fcb01cd64de0a1d6f8f8c897d16cc2628be53960.zip external_webkit-fcb01cd64de0a1d6f8f8c897d16cc2628be53960.tar.gz external_webkit-fcb01cd64de0a1d6f8f8c897d16cc2628be53960.tar.bz2 |
Switch find on page to GL
Bug: 5354191
Refactor how extras are drawn in GL
Change-Id: Ifb61c73abecd2d074903a7fb44fe4b82aacc64ac
Diffstat (limited to 'Source/WebKit')
-rw-r--r-- | Source/WebKit/android/nav/FindCanvas.h | 3 | ||||
-rw-r--r-- | Source/WebKit/android/nav/WebView.cpp | 50 |
2 files changed, 20 insertions, 33 deletions
diff --git a/Source/WebKit/android/nav/FindCanvas.h b/Source/WebKit/android/nav/FindCanvas.h index 994ff17..0fa095c 100644 --- a/Source/WebKit/android/nav/FindCanvas.h +++ b/Source/WebKit/android/nav/FindCanvas.h @@ -222,7 +222,7 @@ public: m_isFindPaintSetUp = false; m_lastBounds.setEmpty(); } - virtual ~FindOnPage() { delete m_matches; } + virtual ~FindOnPage() { if (m_matches) delete m_matches; } void clearCurrentLocation() { m_hasCurrentLocation = false; } IntRect currentMatchBounds() const; int currentMatchIndex() const { return m_findIndex; } @@ -234,6 +234,7 @@ public: void findNext(bool forward); bool isCurrentLocationValid() { return m_hasCurrentLocation; } void setMatches(WTF::Vector<MatchInfo>* matches); + WTF::Vector<MatchInfo>* matches() { return m_matches; } private: void drawMatch(const SkRegion& region, SkCanvas* canvas, bool focused); void setUpFindPaint(); diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index 13e1f5f..1dcc7c4 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -529,6 +529,8 @@ bool drawGL(WebCore::IntRect& viewRect, WebCore::IntRect* invalRect, WebCore::In if (!m_glWebViewState) { m_glWebViewState = new GLWebViewState(&m_viewImpl->gButtonMutex); + m_glWebViewState->glExtras()->setCursorRingExtra(&m_ring); + m_glWebViewState->glExtras()->setFindOnPageExtra(&m_findOnPage); if (m_baseLayer->content()) { SkRegion region; SkIRect rect; @@ -569,44 +571,28 @@ bool drawGL(WebCore::IntRect& viewRect, WebCore::IntRect* invalRect, WebCore::In unsigned int pic = m_glWebViewState->currentPictureCounter(); - SkPicture picture; - IntRect rect(0, 0, 0, 0); - bool allowSame = false; - m_glWebViewState->resetRings(); - if (extra) { - if (extra == &m_ring) { - WTF::Vector<IntRect> rings; - if (!m_ring.m_isButton && root == m_ring.m_frame) - rings = m_ring.rings(); - else { - // TODO: Fix the navcache to work with layers correctly - // In the meantime, this works around the bug. However, the rings - // it produces are not as nice for some reason, thus we use - // m_ring.rings() above for the base layer instead of the below - for (size_t i = 0; i < m_ring.m_node->rings().size(); i++) { - IntRect rect = m_ring.m_node->rings().at(i); - rect = m_ring.m_frame->adjustBounds(m_ring.m_node, rect); - if (!m_ring.m_isButton) - rect.inflate(4); - rings.append(rect); - } + if (extra == &m_ring) { + if (m_ring.m_isButton || root != m_ring.m_frame) { + // TODO: Fix the navcache to work with layers correctly + // In the meantime, this works around the bug. However, the rings + // it produces are not as nice for some reason, thus we use + // m_ring.rings() as produced by navcache for the base layer and + // for layers we generate a new ring set + m_ring.rings().clear(); + for (size_t i = 0; i < m_ring.m_node->rings().size(); i++) { + IntRect rect = m_ring.m_node->rings().at(i); + rect = m_ring.m_frame->adjustBounds(m_ring.m_node, rect); + if (!m_ring.m_isButton) + rect.inflate(4); + m_ring.rings().append(rect); } - m_glWebViewState->setRings(rings, m_ring.m_isPressed, m_ring.m_isButton); - extra = 0; - } else { - LayerAndroid mainPicture(m_navPictureUI); - PictureSet* content = m_baseLayer->content(); - SkCanvas* canvas = picture.beginRecording(content->width(), - content->height()); - extra->draw(canvas, &mainPicture, &rect); - picture.endRecording(); } } - m_glWebViewState->setExtra(m_baseLayer, picture, rect, allowSame); + m_glWebViewState->glExtras()->setDrawExtra(extra); LayerAndroid* compositeLayer = compositeRoot(); if (compositeLayer) - compositeLayer->setExtra(extra); + compositeLayer->setExtra(0); SkRect visibleRect; calcOurContentVisibleRect(&visibleRect); |