summaryrefslogtreecommitdiffstats
path: root/pdf
diff options
context:
space:
mode:
authortommycli <tommycli@chromium.org>2015-04-13 16:55:35 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-13 23:56:06 +0000
commit4d903a9645edd964b26e2afc4391aa9949c3c0c8 (patch)
tree65d8d7cbaf557e7b441bbe3ba5bea097ce9e4b75 /pdf
parent5d6dd8eaee742daf7f298f533fb0827dc4a693fd (diff)
downloadchromium_src-4d903a9645edd964b26e2afc4391aa9949c3c0c8.zip
chromium_src-4d903a9645edd964b26e2afc4391aa9949c3c0c8.tar.gz
chromium_src-4d903a9645edd964b26e2afc4391aa9949c3c0c8.tar.bz2
PDF Plugin: Swallow Invalidate calls before getting initial size
The PDF Plugin current expects the size to be set before any invalidate operations, and will DCHECK that. https://crrev.com/323331 broke this, as the initial size is given to the plugin is now deferred to give the DOM a chance to 'settle down'. Instead, we can just ignore invalidate calls before the size is set. When the size is actually set, the whole page will be invalidated anyways, so there's no harm. BUG=474428 Review URL: https://codereview.chromium.org/1067043002 Cr-Commit-Position: refs/heads/master@{#324947}
Diffstat (limited to 'pdf')
-rw-r--r--pdf/paint_manager.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/pdf/paint_manager.cc b/pdf/paint_manager.cc
index f452b37..925e1a0 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();