Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: pdf/paint_aggregator.cc

Issue 1160513004: Fix graphics corruption that can occur in the PDF viewer when scrolling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/paint_aggregator.cc
diff --git a/pdf/paint_aggregator.cc b/pdf/paint_aggregator.cc
index 549cab6d091646a783f52ccafeae94c4cbf12cff..09073ec30fa76d5e5c208e36ed7b23f2ab17f1d5 100644
--- a/pdf/paint_aggregator.cc
+++ b/pdf/paint_aggregator.cc
@@ -8,6 +8,14 @@
#include "base/logging.h"
+namespace {
+
+bool IsNegative(int32_t num) {
+ return num < 0;
+}
+
+} // namespace
+
// ----------------------------------------------------------------------------
// ALGORITHM NOTES
//
@@ -145,6 +153,25 @@ void PaintAggregator::ScrollRect(const pp::Rect& clip_rect,
return;
}
+ // If we scroll in a reverse direction to the direction we originally scrolled
+ // and there were invalidations that happened in-between we may end up
+ // incorrectly clipping the invalidated rects (see crbug.com/488390). This bug
+ // doesn't exist in the original implementation
+ // (ppapi/utility/graphics/paint_aggregator.cc) which uses a different method
+ // of handling invalidations that occur after a scroll. The problem is that
+ // when we scroll the invalidated region, we clip it to the scroll rect. This
+ // can cause us to lose information about what the invalidated region was if
+ // it gets scrolled back into view. We either need to not do this clipping or
+ // disallow combining scrolls that occur in different directions with
+ // invalidations that happen in-between. This code really needs some tests...
+ if (!update_.paint_rects.empty()) {
+ if (IsNegative(amount.x()) != IsNegative(update_.scroll_delta.x()) ||
+ IsNegative(amount.y()) != IsNegative(update_.scroll_delta.y())) {
+ InvalidateRect(clip_rect);
+ return;
+ }
+ }
+
// The scroll rect is new or isn't changing (though the scroll amount may
// be changing).
update_.scroll_rect = clip_rect;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698