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

Side by Side Diff: chrome/browser/resources/print_preview/margin_settings.js

Issue 8592003: Print Preview: Fixing javascript error occuring in the margins code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Creating getter in previewArea Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 cr.define('print_preview', function() { 5 cr.define('print_preview', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Creates a Margins object that holds four margin values. The units in which 9 * Creates a Margins object that holds four margin values. The units in which
10 * the values are expressed can be any numeric value. 10 * the values are expressed can be any numeric value.
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 this.getMarginValueLimits_(), 528 this.getMarginValueLimits_(),
529 keepDisplayedValue, 529 keepDisplayedValue,
530 this.getMarginValueLimitsInPercent_()); 530 this.getMarginValueLimitsInPercent_());
531 this.marginsUI.draw(); 531 this.marginsUI.draw();
532 }, 532 },
533 533
534 /** 534 /**
535 * Called when there is change in the preview position or size. 535 * Called when there is change in the preview position or size.
536 */ 536 */
537 onPreviewPositionChanged: function() { 537 onPreviewPositionChanged: function() {
538 if (!previewArea.pdfPlugin)
539 return;
538 if (this.isCustomMarginsSelected() && previewArea.pdfLoaded && 540 if (this.isCustomMarginsSelected() && previewArea.pdfLoaded &&
539 pageSettings.totalPageCount != undefined) { 541 pageSettings.totalPageCount != undefined) {
542 this.updatePageData_();
kmadhusu 2011/11/21 19:20:22 Can you explain why you need to update the page da
dpapad 2011/11/22 02:05:10 Yes. cutomMargins_ might not be initialized when t
540 this.drawCustomMarginsUI_(); 543 this.drawCustomMarginsUI_();
541 } 544 }
542 }, 545 },
543 546
544 /** 547 /**
545 * Executes when a margin textbox is focused. Used for improved 548 * Executes when a margin textbox is focused. Used for improved
546 * accessibility. 549 * accessibility.
547 * @private 550 * @private
548 */ 551 */
549 onMarginTextboxFocused_: function() { 552 onMarginTextboxFocused_: function() {
(...skipping 23 matching lines...) Expand all
573 this.forceDisplayingMarginLines_ = true; 576 this.forceDisplayingMarginLines_ = true;
574 this.previousCustomMargins_ = null; 577 this.previousCustomMargins_ = null;
575 setDefaultValuesAndRegeneratePreview(false); 578 setDefaultValuesAndRegeneratePreview(false);
576 }, 579 },
577 580
578 /** 581 /**
579 * Executes when the custom margins option is selected. 582 * Executes when the custom margins option is selected.
580 * @private 583 * @private
581 */ 584 */
582 onCustomMarginsSelected_: function() { 585 onCustomMarginsSelected_: function() {
586 if (!previewArea.pdfPlugin) {
587 this.forceMarginsUIOnPDFLoad_ = true;
588 return;
589 }
583 var customMarginsNotSpecified = !this.customMargins_; 590 var customMarginsNotSpecified = !this.customMargins_;
584 this.updatePageData_(); 591 this.updatePageData_();
585 592
586 if (customMarginsNotSpecified) { 593 if (customMarginsNotSpecified) {
587 this.previousCustomMargins_ = this.customMargins_.clone(); 594 this.previousCustomMargins_ = this.customMargins_.clone();
588 this.drawCustomMarginsUI_(); 595 this.drawCustomMarginsUI_();
589 this.addCustomMarginEventListeners_(); 596 this.addCustomMarginEventListeners_();
590 this.marginsUI.show(); 597 this.marginsUI.show();
591 } else { 598 } else {
592 this.forceMarginsUIOnPDFLoad_ = true; 599 this.forceMarginsUIOnPDFLoad_ = true;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 this.pageWidth_ = this.currentDefaultPageLayout.pageWidth; 696 this.pageWidth_ = this.currentDefaultPageLayout.pageWidth;
690 this.pageHeight_ = this.currentDefaultPageLayout.pageHeight; 697 this.pageHeight_ = this.currentDefaultPageLayout.pageHeight;
691 } 698 }
692 }; 699 };
693 700
694 return { 701 return {
695 MarginSettings: MarginSettings, 702 MarginSettings: MarginSettings,
696 PageLayout: PageLayout, 703 PageLayout: PageLayout,
697 }; 704 };
698 }); 705 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698