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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/PannerNode.cpp

Issue 2512793003: Throw RangeError for invalid refDistance/maxDistance (Closed)
Patch Set: Rebase Created 4 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 node->positionZ()->setValue(options.positionZ()); 671 node->positionZ()->setValue(options.positionZ());
672 672
673 if (options.hasOrientationX()) 673 if (options.hasOrientationX())
674 node->orientationX()->setValue(options.orientationX()); 674 node->orientationX()->setValue(options.orientationX());
675 if (options.hasOrientationY()) 675 if (options.hasOrientationY())
676 node->orientationY()->setValue(options.orientationY()); 676 node->orientationY()->setValue(options.orientationY());
677 if (options.hasOrientationZ()) 677 if (options.hasOrientationZ())
678 node->orientationZ()->setValue(options.orientationZ()); 678 node->orientationZ()->setValue(options.orientationZ());
679 679
680 if (options.hasRefDistance()) 680 if (options.hasRefDistance())
681 node->setRefDistance(options.refDistance()); 681 node->setRefDistance(options.refDistance(), exceptionState);
682 if (options.hasMaxDistance()) 682 if (options.hasMaxDistance())
683 node->setMaxDistance(options.maxDistance()); 683 node->setMaxDistance(options.maxDistance(), exceptionState);
684 if (options.hasRolloffFactor()) 684 if (options.hasRolloffFactor())
685 node->setRolloffFactor(options.rolloffFactor()); 685 node->setRolloffFactor(options.rolloffFactor());
686 if (options.hasConeInnerAngle()) 686 if (options.hasConeInnerAngle())
687 node->setConeInnerAngle(options.coneInnerAngle()); 687 node->setConeInnerAngle(options.coneInnerAngle());
688 if (options.hasConeOuterAngle()) 688 if (options.hasConeOuterAngle())
689 node->setConeOuterAngle(options.coneOuterAngle()); 689 node->setConeOuterAngle(options.coneOuterAngle());
690 if (options.hasConeOuterGain()) 690 if (options.hasConeOuterGain())
691 node->setConeOuterGain(options.coneOuterGain()); 691 node->setConeOuterGain(options.coneOuterGain());
692 692
693 return node; 693 return node;
(...skipping 24 matching lines...) Expand all
718 } 718 }
719 719
720 void PannerNode::setDistanceModel(const String& model) { 720 void PannerNode::setDistanceModel(const String& model) {
721 pannerHandler().setDistanceModel(model); 721 pannerHandler().setDistanceModel(model);
722 } 722 }
723 723
724 double PannerNode::refDistance() const { 724 double PannerNode::refDistance() const {
725 return pannerHandler().refDistance(); 725 return pannerHandler().refDistance();
726 } 726 }
727 727
728 void PannerNode::setRefDistance(double distance) { 728 void PannerNode::setRefDistance(double distance,
729 ExceptionState& exceptionState) {
730 if (distance <= 0) {
731 exceptionState.throwDOMException(
732 V8RangeError, ExceptionMessages::indexExceedsMinimumBound<double>(
733 "refDistance", distance, 0));
734 return;
735 }
736
729 pannerHandler().setRefDistance(distance); 737 pannerHandler().setRefDistance(distance);
730 } 738 }
731 739
732 double PannerNode::maxDistance() const { 740 double PannerNode::maxDistance() const {
733 return pannerHandler().maxDistance(); 741 return pannerHandler().maxDistance();
734 } 742 }
735 743
736 void PannerNode::setMaxDistance(double distance) { 744 void PannerNode::setMaxDistance(double distance,
745 ExceptionState& exceptionState) {
746 if (distance <= 0) {
747 exceptionState.throwDOMException(
748 V8RangeError, ExceptionMessages::indexExceedsMinimumBound<double>(
749 "maxDistance", distance, 0));
750 return;
751 }
752
737 pannerHandler().setMaxDistance(distance); 753 pannerHandler().setMaxDistance(distance);
738 } 754 }
739 755
740 double PannerNode::rolloffFactor() const { 756 double PannerNode::rolloffFactor() const {
741 return pannerHandler().rolloffFactor(); 757 return pannerHandler().rolloffFactor();
742 } 758 }
743 759
744 void PannerNode::setRolloffFactor(double factor) { 760 void PannerNode::setRolloffFactor(double factor) {
745 pannerHandler().setRolloffFactor(factor); 761 pannerHandler().setRolloffFactor(factor);
746 } 762 }
(...skipping 28 matching lines...) Expand all
775 visitor->trace(m_positionZ); 791 visitor->trace(m_positionZ);
776 792
777 visitor->trace(m_orientationX); 793 visitor->trace(m_orientationX);
778 visitor->trace(m_orientationY); 794 visitor->trace(m_orientationY);
779 visitor->trace(m_orientationZ); 795 visitor->trace(m_orientationZ);
780 796
781 AudioNode::trace(visitor); 797 AudioNode::trace(visitor);
782 } 798 }
783 799
784 } // namespace blink 800 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/PannerNode.h ('k') | third_party/WebKit/Source/modules/webaudio/PannerNode.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698