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

Unified Diff: pdf/paint_manager.cc

Issue 1067043002: PDF Plugin: Swallow Invalidate calls before getting initial size (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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_manager.cc
diff --git a/pdf/paint_manager.cc b/pdf/paint_manager.cc
index f452b37186e9765ef7f65d37ef629eb5a298a340..925e1a010c063af66454148195809d342e55a582 100644
--- a/pdf/paint_manager.cc
+++ b/pdf/paint_manager.cc
@@ -97,8 +97,8 @@ void PaintManager::SetSize(const pp::Size& new_size, float device_scale) {
}
void PaintManager::Invalidate() {
- // You must call SetSize before using.
- DCHECK(!graphics_.is_null() || has_pending_resize_);
+ if (graphics_.is_null() && !has_pending_resize_)
+ return;
EnsureCallbackPending();
aggregator_.InvalidateRect(pp::Rect(GetEffectiveSize()));
@@ -107,8 +107,8 @@ void PaintManager::Invalidate() {
void PaintManager::InvalidateRect(const pp::Rect& rect) {
DCHECK(!in_paint_);
- // You must call SetSize before using.
- DCHECK(!graphics_.is_null() || has_pending_resize_);
+ if (graphics_.is_null() && !has_pending_resize_)
+ return;
// Clip the rect to the device area.
pp::Rect clipped_rect = rect.Intersect(pp::Rect(GetEffectiveSize()));
@@ -123,8 +123,8 @@ void PaintManager::ScrollRect(const pp::Rect& clip_rect,
const pp::Point& amount) {
DCHECK(!in_paint_);
- // You must call SetSize before using.
- DCHECK(!graphics_.is_null() || has_pending_resize_);
+ if (graphics_.is_null() && !has_pending_resize_)
+ return;
EnsureCallbackPending();
« 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