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

Side by Side Diff: pdf/out_of_process_instance.cc

Issue 2077463002: Call pp::Size::IsEmpty() instead of !pp::Size::GetArea(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | pdf/pdfium/pdfium_engine.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "pdf/out_of_process_instance.h" 5 #include "pdf/out_of_process_instance.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> // for min/max() 10 #include <algorithm> // for min/max()
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 } 1438 }
1439 int bottom_of_document = 1439 int bottom_of_document =
1440 GetDocumentPixelHeight() + (top_toolbar_height_ * device_scale_); 1440 GetDocumentPixelHeight() + (top_toolbar_height_ * device_scale_);
1441 if (bottom_of_document < available_area_.height()) 1441 if (bottom_of_document < available_area_.height())
1442 available_area_.set_height(bottom_of_document); 1442 available_area_.set_height(bottom_of_document);
1443 1443
1444 CalculateBackgroundParts(); 1444 CalculateBackgroundParts();
1445 engine_->PageOffsetUpdated(available_area_.point()); 1445 engine_->PageOffsetUpdated(available_area_.point());
1446 engine_->PluginSizeUpdated(available_area_.size()); 1446 engine_->PluginSizeUpdated(available_area_.size());
1447 1447
1448 if (!document_size_.GetArea()) 1448 if (document_size_.IsEmpty())
1449 return; 1449 return;
1450 paint_manager_.InvalidateRect(pp::Rect(pp::Point(), plugin_size_)); 1450 paint_manager_.InvalidateRect(pp::Rect(pp::Point(), plugin_size_));
1451 } 1451 }
1452 1452
1453 void OutOfProcessInstance::LoadUrl(const std::string& url) { 1453 void OutOfProcessInstance::LoadUrl(const std::string& url) {
1454 LoadUrlInternal(url, &embed_loader_, &OutOfProcessInstance::DidOpen); 1454 LoadUrlInternal(url, &embed_loader_, &OutOfProcessInstance::DidOpen);
1455 } 1455 }
1456 1456
1457 void OutOfProcessInstance::LoadPreviewUrl(const std::string& url) { 1457 void OutOfProcessInstance::LoadPreviewUrl(const std::string& url) {
1458 LoadUrlInternal(url, &embed_preview_loader_, 1458 LoadUrlInternal(url, &embed_preview_loader_,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 const pp::FloatPoint& scroll_offset) { 1557 const pp::FloatPoint& scroll_offset) {
1558 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width(); 1558 float max_x = document_size_.width() * zoom_ - plugin_dip_size_.width();
1559 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f); 1559 float x = std::max(std::min(scroll_offset.x(), max_x), 0.0f);
1560 float min_y = -top_toolbar_height_; 1560 float min_y = -top_toolbar_height_;
1561 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height(); 1561 float max_y = document_size_.height() * zoom_ - plugin_dip_size_.height();
1562 float y = std::max(std::min(scroll_offset.y(), max_y), min_y); 1562 float y = std::max(std::min(scroll_offset.y(), max_y), min_y);
1563 return pp::FloatPoint(x, y); 1563 return pp::FloatPoint(x, y);
1564 } 1564 }
1565 1565
1566 } // namespace chrome_pdf 1566 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « no previous file | pdf/pdfium/pdfium_engine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698