Skip to content

Commit 6675f69

Browse files
ChrisCraikAndroid (Google) Code Review
authored andcommitted
Merge "Invalidate on new picture if scale/content size changes" into jb-dev
2 parents c8654ac + 02c2f45 commit 6675f69

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

core/java/android/webkit/WebViewClassic.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2939,6 +2939,7 @@ private void recordNewContentSize(int w, int h, boolean updateLayout) {
29392939

29402940
// premature data from webkit, ignore
29412941
if ((w | h) == 0) {
2942+
invalidate();
29422943
return;
29432944
}
29442945

@@ -2951,17 +2952,15 @@ private void recordNewContentSize(int w, int h, boolean updateLayout) {
29512952
// updated when we get out of that mode.
29522953
if (!mDrawHistory) {
29532954
// repin our scroll, taking into account the new content size
2954-
if (updateScrollCoordinates(pinLocX(getScrollX()),
2955-
pinLocY(getScrollY()))) {
2956-
invalidate();
2957-
}
2955+
updateScrollCoordinates(pinLocX(getScrollX()), pinLocY(getScrollY()));
29582956
if (!mScroller.isFinished()) {
29592957
// We are in the middle of a scroll. Repin the final scroll
29602958
// position.
29612959
mScroller.setFinalX(pinLocX(mScroller.getFinalX()));
29622960
mScroller.setFinalY(pinLocY(mScroller.getFinalY()));
29632961
}
29642962
}
2963+
invalidate();
29652964
}
29662965
contentSizeChanged(updateLayout);
29672966
}
@@ -7956,7 +7955,8 @@ void setNewPicture(final WebViewCore.DrawData draw, boolean updateBaseLayer) {
79567955
}
79577956

79587957
// update the zoom information based on the new picture
7959-
mZoomManager.onNewPicture(draw);
7958+
if (mZoomManager.onNewPicture(draw))
7959+
invalidate();
79607960

79617961
if (isPictureAfterFirstLayout) {
79627962
mViewManager.postReadyToDrawAll();

core/java/android/webkit/ZoomManager.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,8 +1008,10 @@ public void updateZoomRange(WebViewCore.ViewState viewState,
10081008
/**
10091009
* Updates zoom values when Webkit produces a new picture. This method
10101010
* should only be called from the UI thread's message handler.
1011+
*
1012+
* @return True if zoom value has changed
10111013
*/
1012-
public void onNewPicture(WebViewCore.DrawData drawData) {
1014+
public boolean onNewPicture(WebViewCore.DrawData drawData) {
10131015
final int viewWidth = mWebView.getViewWidth();
10141016
final boolean zoomOverviewWidthChanged = setupZoomOverviewWidth(drawData, viewWidth);
10151017
final float newZoomOverviewScale = getZoomOverviewScale();
@@ -1056,6 +1058,8 @@ public void onNewPicture(WebViewCore.DrawData drawData) {
10561058
// so next new picture could be forced into overview mode if it's true.
10571059
mInitialZoomOverview = mInZoomOverview;
10581060
}
1061+
1062+
return scaleHasDiff;
10591063
}
10601064

10611065
/**

0 commit comments

Comments
 (0)