diff options
| author | Cary Clark <cary@android.com> | 2010-08-23 17:06:50 -0400 |
|---|---|---|
| committer | Cary Clark <cary@android.com> | 2010-08-24 08:42:58 -0400 |
| commit | b4239e11f8fe298bc8aa4350fcd91cc4990fc620 (patch) | |
| tree | 6af929490b73c9e1bf239797221da64e8bbba9f4 | |
| parent | e4be1fd5f14137de249ee66c000f9dadfb2862d7 (diff) | |
| download | external_webkit-b4239e11f8fe298bc8aa4350fcd91cc4990fc620.zip external_webkit-b4239e11f8fe298bc8aa4350fcd91cc4990fc620.tar.gz external_webkit-b4239e11f8fe298bc8aa4350fcd91cc4990fc620.tar.bz2 | |
check for null pictures when selecting text
The LayerAndroid supplied to SelectText may have no picture
associated with it. If that's the case, ignore it.
This change was original uploaded as
https://android-git.corp.google.com/g/#change,62627
in master, but then I realized it should go into
gingerbread as well, and get merged into master automagically.
http://b/2930142
Change-Id: If6332d81f1f9baba804131caae124dd18e0b0799
| -rw-r--r-- | WebKit/android/nav/SelectText.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/WebKit/android/nav/SelectText.cpp b/WebKit/android/nav/SelectText.cpp index 7665972..fc93972 100644 --- a/WebKit/android/nav/SelectText.cpp +++ b/WebKit/android/nav/SelectText.cpp @@ -1239,12 +1239,15 @@ SelectText::SelectText() paint.setColor(0xffaaaaaa); canvas->drawPath(endPath, paint); m_endControl.endRecording(); + m_picture = 0; } void SelectText::draw(SkCanvas* canvas, LayerAndroid* layer) { // FIXME: layer may not own the original selected picture m_picture = layer->picture(); + if (!m_picture) + return; DBG_NAV_LOGD("m_extendSelection=%d m_drawPointer=%d", m_extendSelection, m_drawPointer); if (m_extendSelection) drawSelectionRegion(canvas); @@ -1316,6 +1319,8 @@ void SelectText::drawSelectionRegion(SkCanvas* canvas) void SelectText::extendSelection(const SkPicture* picture, int x, int y) { + if (!picture) + return; SkIRect clipRect = m_visibleRect; int base; if (m_startSelection) { @@ -1365,6 +1370,8 @@ void SelectText::extendSelection(const SkPicture* picture, int x, int y) const String SelectText::getSelection() { + if (!m_picture) + return String(); SkIRect clipRect; clipRect.set(0, 0, m_picture->width(), m_picture->height()); String result = text(*m_picture, clipRect, m_selStart, m_startBase, @@ -1424,6 +1431,8 @@ bool SelectText::hitSelection(int x, int y) const void SelectText::moveSelection(const SkPicture* picture, int x, int y) { + if (!picture) + return; SkIRect clipRect = m_visibleRect; clipRect.join(m_selStart); clipRect.join(m_selEnd); |
