You are on page 1of 4

8/27/2014 Android WebView JellyBean -> Should not happen: no rect-based-test nodes found - Stack Overflow

http://stackoverflow.com/questions/12090899/android-webview-jellybean-should-not-happen-no-rect-based-test-nodes-found 1/4
Konstantin
2,025 1 15 37
5 Answers
MyapplicationisusingalotofwebviewswhicharelyinginfragmentswhichareholdbyaViewPager.
WheneveriswipethroughtheapponmyGalaxyNexuswithJellybeanonitigetthefollowingconsole
messageagainandagain:
Cananyoneexplaintomewhatisgoingwrongheresothatimightbeabletofixtheissue?
android webview androidwebview android4.2jellybean
editedFeb7'13at12:32 askedAug23'12at11:50
By"alot"meansroughlyhowmanyWebViews?>256?>1024?I'mjustcurious.StephenQuanSep7'12at
12:28
About40tops!1foreachFragment. Konstantin Sep8'12at7:41
Maybethiscanhelp:stackoverflow.com/questions/12364971/AndreiRoscaFeb21'13at23:45
Ifacedexactlythesameproblem.Inmyappwhereverihadclickeventscodedusing'touchend'injquery
bind(),thiserrorwascomingupanditusedtoneverrespondtoclicks(taps)..andgaveafrozenkindoffeel.
SoIjusttriedreplacing'touchend'with'click'inbind(),anditworked!respondedtoclicks(Taps)andalso
didn'tshowthatlogentryofwebcoreglue..
IalsofoundthispieceofcodeinAndroid'swebviewcode..
Android WebView JellyBean > Should not happen: no rectbasedtest nodes found
08-23 13:44:03.374: E/webcoreglue(21690): Should not happen: no rect-based-test nodes found


8 2

help

addacomment
8/27/2014 Android WebView JellyBean -> Should not happen: no rect-based-test nodes found - Stack Overflow
http://stackoverflow.com/questions/12090899/android-webview-jellybean-should-not-happen-no-rect-based-test-nodes-found 2/4
RahulDole
578 5 15
andthistoo..
Noticethatlogmessagethere?Iamguessingthiscodeisforidentifyingthexandyaxisvectorsgenerated
onclicksortapsorswipes..
editedSep10'12at9:37 answeredSep7'12at11:51
Idontusemakeuseofjquerysbind.Butnotherlessyouranswermightgivesomedirectionwheretheproblem
mightbe.InfactiuseZeptoinsteadofJquerybutalsonoZeptobinds. Konstantin Sep8'12at7:44
Areyoudoing webView.destroy() inthe onDestroy() functioninmain.javafile?RahulDoleSep8
'12at14:37
1 Iputthewebview.destroy()intothefragmentsonDestroy()unfortunalywithnosuccess.Buttheproblemcould
berelatedtothelifecycle.asiswipethroughthepagerthemessageoccurs.Iusea
fragmentStatePagerAdapter. Konstantin Sep10'12at6:44
3 Theuseoftheclickeventisnotreallyperfectasithasadelayof400mscomparedtothetouchendevent.Do
youguysknowifit'sabuginAndroidoruswhoaredoingsomethingwrong???FabienDemangeatNov16
'12at11:28
9 ImetwithJohnReck,anengineerontheAndroidWebViewteam,acoupleofdaysago.Heconfirmedthatthis
isabugbasicallyaraceconditionwherethewebkitlayoutenginegetsoutofsyncwiththeAndroidlayoutand
startsmappingtoucheventstoanincorrectcoordinatesystem.Untilthebugisfixed,callingonScrollChanged()
toresyncthelayoutsseemstobethebestworkaround.IanNiLewisApr10'13at18:05
show6morecomments
HTMLElement* WebViewCore::retrieveElement(int x, int y,
const QualifiedName& tagName)
{
HitTestResult hitTestResult = m_mainFrame->eventHandler()
->hitTestResultAtPoint(IntPoint(x, y), false, false,
DontHitTestScrollbars, HitTestRequest::Active | HitTestRequest::ReadOnly
IntSize(1, 1));
if (!hitTestResult.innerNode() || !hitTestResult.innerNode()->inDocument())
LOGE("Should not happen: no in document Node found");
return 0;
}
const ListHashSet<RefPtr<Node> >& list = hitTestResult.rectBasedTestResult();
if (list.isEmpty()) {
LOGE("Should not happen: no rect-based-test nodes found");
return 0;
}
Node* node = hitTestResult.innerNode();
Node* element = node;
while (element && (!element->isElementNode()
|| !element->hasTagName(tagName))) {
element = element->parentNode();
}
DBG_NAV_LOGD("node=%p element=%p x=%d y=%d nodeName=%s tagName=%s", node,
element, x, y, node->nodeName().utf8().data(),
element ? ((Element*) element)->tagName().utf8().data() : "<none>");
return static_cast<WebCore::HTMLElement*>(element);
}
// get the highlight rectangles for the touch point (x, y) with the slop
Vector<IntRect> WebViewCore::getTouchHighlightRects(int x, int y, int slop)
{
Vector<IntRect> rects;
m_mousePos = IntPoint(x - m_scrollOffsetX, y - m_scrollOffsetY);
HitTestResult hitTestResult = m_mainFrame->eventHandler()->hitTestResultAtPoint
false, false, DontHitTestScrollbars, HitTestRequest::Active | HitTestRequest
if (!hitTestResult.innerNode() || !hitTestResult.innerNode()->inDocument())
LOGE("Should not happen: no in document Node found");
return rects;
}
const ListHashSet<RefPtr<Node> >& list = hitTestResult.rectBasedTestResult();
if (list.isEmpty()) {
LOGE("Should not happen: no rect-based-test nodes found");
return rects;
}
//Rest of the part is omitted here...
8/27/2014 Android WebView JellyBean -> Should not happen: no rect-based-test nodes found - Stack Overflow
http://stackoverflow.com/questions/12090899/android-webview-jellybean-should-not-happen-no-rect-based-test-nodes-found 3/4
Codeversed
1,408 7 15
TamilSelvan
4,237 4 10 29
JohnReck
191 1 2
Ihadthisexactissue.TheproblemisexactlywhatRahulDolesaidinhisanswerabove.
Ispendafewdaysonthistryingtonsofdifferentthings.Inoticedthatwhentheorientationchangedthatthe
visibleWebViewonLongClickworkedagain...soIcameupwiththislittlegem.Indeeditsveryhackybutit
works!
UsethisinyourclassthatextendsWebView:
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN){
int temp_ScrollY = getScrollY();
scrollTo(getScrollX(), getScrollY() + 1);
scrollTo(getScrollX(), temp_ScrollY);
}
return super.onTouchEvent(event);
}
answeredMar1'13at8:15
YoucangetthesameeffectbycallingonScrollChanged()directly.IanNiLewisApr10'13at18:00
TheissueoccursbecauseinsomescenariosWebViewfailstonoticethatitsvisiblerecthaschanged,soas
faraswebkitisconcernedthepageisstillnotvisible.Thusalltouchesfalloutsideofthewindow,andget
rejected.
ThecleanestfixiswhenyouknowthevisibilityofyourWebViewhaschanged(suchasinresponsetoa
setPrimaryItemcallbackfromaviewpager),call
webview.onScrollChanged(webview.getScrollX(), webview.getScrollY());
YouwillneedtosubclassthewebviewtopromotetheprotectedonScrollChangedtoapublicmethod.
editedMay28'13at12:19 answeredApr19'13at1:38
1 Thisistheclearestexplanationandcleanestsolution,shouldbethetopanswer.fhuchoJul17'13at11:02
1 Thisanswerputmeontherighttrack.Iadded public void applyAfterMoveFix() {
onScrollChanged(getScrollX(), getScrollY(), getScrollX(), getScrollY());
} tomywebviewsubclass.JuozasKontvainisAug1'13at8:53
HavethesameproblemwithJellyBeanandViewPager+fragmentsthatcontainsWebViews.AndallOK
withthesamecoderunningonAndroid2.2,soIthinkthisisabuginJBWebViewimplementation.
OnJBonlythefirstshownfragmentwithWebViewworksright,withouterrors"Shouldnothappen.."inthe
log,andgetHitTestResult()callsreturnscorrectvalues.Swipingtothenextpages,Igoterrorsinlogand
getHitTestResult()returnsonlyzeroesandnulls.
NowIfoundonlyonesolutiontocreatefragmentswithemptycontainersandcreateWebViews,setupthey
andloaddataonlywhencurrentfragmentbecomesactiveintheViewPager.InthiscaseWebViewworksas
needed.But,unfortunately,thiscompletelybreaksanideaofsmoothswipingpagesintheViewPager.
Havethelastidea,tomorrowwilltrytoreplaceViewPager'sfragmentstocompoundviews.Littlechances,
butI'llletyouknowifresultswillbesuccessful.
addacomment
addacomment
8/27/2014 Android WebView JellyBean -> Should not happen: no rect-based-test nodes found - Stack Overflow
http://stackoverflow.com/questions/12090899/android-webview-jellybean-should-not-happen-no-rect-based-test-nodes-found 4/4
VladKuts
66 1 6
AdamBubela
471 3 7
answeredDec4'12at22:32
Haveyousolvedit?IamDeveloperFeb28'13at21:53
1 Sorryfordelayedanswer!AsIwroteearlier,IfoundonlyoneworkaroundtocreateWebViewwhencurrent
fragmentbecomesactiveintheViewPager.VladKutsMar11'13at16:41
ItalsohappenedtomewhenIwasworkinginCordova+SenchaTouchenvironment.Because
CordovaActivity doesnothaveanythinglike onScrollChanged() methodIcouldnotapplyanyof
theabovesolutions.
AfterhoursofbangingmyheadagainstthewallIdiscoveredthatsomepartsofwebinterfacehadbeen
calledbeforethiswascompletelyrendered.Inmycasethosemethodsweretriggeredby activate event
in Ext.PanelView .Ireplacedthateventwith painted andsincetheneverythingworkslikeacharm.
AlthoughitisnotcopypastesolutionIhopeitmayhelpsomeonetosavetimeoninvestigation.
answeredJun3at0:20
Not the answer you're looking for? Browse other questions tagged android
webview androidwebview android4.2jellybean or ask your own question.
addacomment
addacomment