Changeset 117755 in webkit
- Timestamp:
- May 21, 2012, 3:44:10 AM (14 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
inspector/front-end/CSSStyleModel.js (modified) (54 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r117754 r117755 1 2012-05-21 Alexander Pavlov <apavlov@chromium.org> 2 3 Web Inspector: Annotate CSSStyleModel.js for the closure compiler 4 https://bugs.webkit.org/show_bug.cgi?id=86858 5 6 Reviewed by Yury Semikhatsky. 7 8 * inspector/front-end/CSSStyleModel.js: 9 (WebInspector.CSSStyleDeclaration.parseComputedStylePayload): 10 (WebInspector.CSSStyleDeclaration.prototype.newBlankProperty): 11 (WebInspector.CSSStyleDeclaration.prototype.insertPropertyAt): 12 (WebInspector.CSSProperty.parsePayload): 13 (WebInspector.CSSProperty.prototype.setText): 14 (WebInspector.CSSProperty.prototype.setDisabled): 15 (WebInspector.CSSStyleSheet.prototype.setText): 16 (WebInspector.CSSStyleModelResourceBinding.prototype._innerSetContent.callbackWrapper): 17 (WebInspector.CSSStyleModelResourceBinding.prototype._innerSetContent): 18 (WebInspector.CSSStyleModelResourceBinding.prototype._loadStyleSheetHeaders): 19 1 20 2012-05-21 Rakesh KN <rakesh.kn@motorola.com> 2 21 -
trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js
r113707 r117755 43 43 } 44 44 45 /** 46 * @param {Array.<CSSAgent.CSSRule>} ruleArray 47 */ 45 48 WebInspector.CSSStyleModel.parseRuleArrayPayload = function(ruleArray) 46 49 { … … 169 172 * @param {DOMAgent.NodeId} nodeId 170 173 * @param {function(WebInspector.CSSRule, boolean)} successCallback 171 * @param { *} rulePayload174 * @param {CSSAgent.CSSRule} rulePayload 172 175 * @param {?Array.<DOMAgent.NodeId>} selectedNodeIds 173 176 */ … … 187 190 * @param {?Protocol.Error} error 188 191 * @param {string} newSelector 189 * @param { *=} rulePayload192 * @param {?CSSAgent.CSSRule} rulePayload 190 193 */ 191 194 function callback(nodeId, successCallback, failureCallback, newSelector, error, rulePayload) … … 216 219 addRule: function(nodeId, selector, successCallback, failureCallback) 217 220 { 221 /** 222 * @param {DOMAgent.NodeId} nodeId 223 * @param {function(WebInspector.CSSRule, boolean)} successCallback 224 * @param {CSSAgent.CSSRule} rulePayload 225 * @param {?Array.<DOMAgent.NodeId>} selectedNodeIds 226 */ 218 227 function checkAffectsCallback(nodeId, successCallback, rulePayload, selectedNodeIds) 219 228 { … … 258 267 }, 259 268 269 /** 270 * @param {DOMAgent.NodeId} nodeId 271 */ 260 272 _ownerDocumentId: function(nodeId) 261 273 { … … 266 278 }, 267 279 280 /** 281 * @param {CSSAgent.StyleSheetId} styleSheetId 282 */ 268 283 _fireStyleSheetChanged: function(styleSheetId) 269 284 { … … 279 294 }, 280 295 296 /** 297 * @param {CSSAgent.StyleSheetId} styleSheetId 298 * @param {string} newText 299 * @param {boolean} majorChange 300 * @param {function(?string)} userCallback 301 */ 281 302 setStyleSheetText: function(styleSheetId, newText, majorChange, userCallback) 282 303 { … … 309 330 /** 310 331 * @constructor 311 * @param { *} payload332 * @param {CSSAgent.CSSStyle} payload 312 333 */ 313 334 WebInspector.CSSStyleDeclaration = function(payload) … … 352 373 } 353 374 375 /** 376 * @param {Array.<CSSAgent.ShorthandEntry>} shorthandEntries 377 * @return {Object} 378 */ 354 379 WebInspector.CSSStyleDeclaration.buildShorthandValueMap = function(shorthandEntries) 355 380 { … … 360 385 } 361 386 387 /** 388 * @param {CSSAgent.CSSStyle} payload 389 * @return {WebInspector.CSSStyleDeclaration} 390 */ 362 391 WebInspector.CSSStyleDeclaration.parsePayload = function(payload) 363 392 { … … 365 394 } 366 395 396 /** 397 * @param {Array.<CSSAgent.CSSComputedStyleProperty>} payload 398 * @return {WebInspector.CSSStyleDeclaration} 399 */ 367 400 WebInspector.CSSStyleDeclaration.parseComputedStylePayload = function(payload) 368 401 { 369 var newPayload = { cssProperties: [], shorthandEntries: [], width: "", height: "" };402 var newPayload = /** @type {CSSAgent.CSSStyle} */ { cssProperties: [], shorthandEntries: [], width: "", height: "" }; 370 403 if (payload) 371 404 newPayload.cssProperties = payload; … … 380 413 }, 381 414 415 /** 416 * @param {string} name 417 * @return {WebInspector.CSSProperty|undefined} 418 */ 382 419 getLiveProperty: function(name) 383 420 { … … 385 422 }, 386 423 424 /** 425 * @param {string} name 426 * @return {string} 427 */ 387 428 getPropertyValue: function(name) 388 429 { … … 391 432 }, 392 433 434 /** 435 * @param {string} name 436 * @return {string} 437 */ 393 438 getPropertyPriority: function(name) 394 439 { … … 397 442 }, 398 443 444 /** 445 * @param {string} name 446 * @return {string} 447 */ 399 448 getPropertyShorthand: function(name) 400 449 { … … 403 452 }, 404 453 454 /** 455 * @param {string} name 456 * @return {boolean} 457 */ 405 458 isPropertyImplicit: function(name) 406 459 { … … 409 462 }, 410 463 464 /** 465 * @return {string} 466 */ 411 467 styleTextWithShorthands: function() 412 468 { … … 440 496 }, 441 497 498 /** 499 * @param {string} name 500 * @return {Array.<WebInspector.CSSProperty>} 501 */ 442 502 getLonghandProperties: function(name) 443 503 { … … 445 505 }, 446 506 507 /** 508 * @param {string} shorthandProperty 509 * @return {string} 510 */ 447 511 getShorthandValue: function(shorthandProperty) 448 512 { … … 451 515 }, 452 516 517 /** 518 * @param {string} shorthandProperty 519 * @return {?string} 520 */ 453 521 getShorthandPriority: function(shorthandProperty) 454 522 { … … 461 529 }, 462 530 531 /** 532 * @param {number} index 533 * @return {?WebInspector.CSSProperty} 534 */ 463 535 propertyAt: function(index) 464 536 { … … 466 538 }, 467 539 540 /** 541 * @return {number} 542 */ 468 543 pastLastSourcePropertyIndex: function() 469 544 { … … 482 557 { 483 558 index = (typeof index === "undefined") ? this.pastLastSourcePropertyIndex() : index; 484 return new WebInspector.CSSProperty(this, index, "", "", "", "active", true, false, false, ""); 485 }, 486 559 return new WebInspector.CSSProperty(this, index, "", "", "", "active", true, false, "", ""); 560 }, 561 562 /** 563 * @param {number} index 564 * @param {string} name 565 * @param {string} value 566 * @param {function(?WebInspector.CSSStyleDeclaration)} userCallback 567 */ 487 568 insertPropertyAt: function(index, name, value, userCallback) 488 569 { 570 /** 571 * @param {function(?WebInspector.CSSStyleDeclaration)} userCallback 572 * @param {?string} error 573 * @param {CSSAgent.CSSStyle} payload 574 */ 489 575 function callback(userCallback, error, payload) 490 576 { … … 501 587 } 502 588 589 if (!this.id) 590 throw "No style id"; 591 503 592 WebInspector.cssModel._pendingCommandsMajorState.push(true); 504 593 CSSAgent.setPropertyText(this.id, index, name + ": " + value + ";", false, callback.bind(this, userCallback)); 505 594 }, 506 595 596 /** 597 * @param {string} name 598 * @param {string} value 599 * @param {function(?WebInspector.CSSStyleDeclaration)} userCallback 600 */ 507 601 appendProperty: function(name, value, userCallback) 508 602 { … … 513 607 /** 514 608 * @constructor 609 * @param {CSSAgent.CSSRule} payload 515 610 */ 516 611 WebInspector.CSSRule = function(payload) … … 528 623 } 529 624 625 /** 626 * @param {CSSAgent.CSSRule} payload 627 * @return {WebInspector.CSSRule} 628 */ 530 629 WebInspector.CSSRule.parsePayload = function(payload) 531 630 { … … 557 656 /** 558 657 * @constructor 658 * @param {?WebInspector.CSSStyleDeclaration} ownerStyle 659 * @param {number} index 660 * @param {string} name 661 * @param {string} value 662 * @param {?string} priority 663 * @param {string} status 664 * @param {boolean} parsedOk 665 * @param {boolean} implicit 666 * @param {string} shorthand 667 * @param {?string=} text 559 668 */ 560 669 WebInspector.CSSProperty = function(ownerStyle, index, name, value, priority, status, parsedOk, implicit, shorthand, text) … … 572 681 } 573 682 683 /** 684 * @param {?WebInspector.CSSStyleDeclaration} ownerStyle 685 * @param {number} index 686 * @param {CSSAgent.CSSProperty} payload 687 * @return {WebInspector.CSSProperty} 688 */ 574 689 WebInspector.CSSProperty.parsePayload = function(ownerStyle, index, payload) 575 690 { … … 581 696 // shorthandName: "" 582 697 var result = new WebInspector.CSSProperty( 583 ownerStyle, index, payload.name, payload.value, payload.priority || "", payload.status || "style", ("parsedOk" in payload) ? payload.parsedOk : true, !!payload.implicit, payload.shorthandName || "", payload.text);698 ownerStyle, index, payload.name, payload.value, payload.priority || "", payload.status || "style", ("parsedOk" in payload) ? !!payload.parsedOk : true, !!payload.implicit, payload.shorthandName || "", payload.text); 584 699 return result; 585 700 } … … 627 742 * @param {boolean} majorChange 628 743 * @param {boolean} overwrite 629 * @param { Function=} userCallback744 * @param {function(?WebInspector.CSSStyleDeclaration)=} userCallback 630 745 */ 631 746 setText: function(propertyText, majorChange, overwrite, userCallback) 632 747 { 748 /** 749 * @param {?WebInspector.CSSStyleDeclaration} style 750 */ 633 751 function enabledCallback(style) 634 752 { … … 637 755 } 638 756 757 /** 758 * @param {?string} error 759 * @param {?CSSAgent.CSSStyle} stylePayload 760 */ 639 761 function callback(error, stylePayload) 640 762 { … … 663 785 throw "No ownerStyle for property"; 664 786 787 if (!this.ownerStyle.id) 788 throw "No owner style id"; 789 665 790 // An index past all the properties adds a new property to the style. 666 791 WebInspector.cssModel._pendingCommandsMajorState.push(majorChange); … … 672 797 * @param {boolean} majorChange 673 798 * @param {boolean} overwrite 674 * @param { Function=} userCallback799 * @param {function(?WebInspector.CSSStyleDeclaration)=} userCallback 675 800 */ 676 801 setValue: function(newValue, majorChange, overwrite, userCallback) … … 680 805 }, 681 806 807 /** 808 * @param {boolean} disabled 809 * @param {function(?WebInspector.CSSStyleDeclaration)=} userCallback 810 */ 682 811 setDisabled: function(disabled, userCallback) 683 812 { … … 687 816 userCallback(this.ownerStyle); 688 817 818 /** 819 * @param {?string} error 820 * @param {CSSAgent.CSSStyle} stylePayload 821 */ 689 822 function callback(error, stylePayload) 690 823 { … … 702 835 } 703 836 837 if (!this.ownerStyle.id) 838 throw "No owner style id"; 839 704 840 WebInspector.cssModel._pendingCommandsMajorState.push(false); 705 841 CSSAgent.toggleProperty(this.ownerStyle.id, this.index, disabled, callback.bind(this)); … … 709 845 /** 710 846 * @constructor 711 * @param { *} payload847 * @param {CSSAgent.CSSMedia} payload 712 848 */ 713 849 WebInspector.CSSMedia = function(payload) … … 726 862 }; 727 863 864 /** 865 * @param {CSSAgent.CSSMedia} payload 866 * @return {WebInspector.CSSMedia} 867 */ 728 868 WebInspector.CSSMedia.parsePayload = function(payload) 729 869 { … … 731 871 } 732 872 873 /** 874 * @param {Array.<CSSAgent.CSSMedia>} payload 875 * @return {Array.<WebInspector.CSSMedia>} 876 */ 733 877 WebInspector.CSSMedia.parseMediaArrayPayload = function(payload) 734 878 { … … 741 885 /** 742 886 * @constructor 887 * @param {CSSAgent.CSSStyleSheetBody} payload 743 888 */ 744 889 WebInspector.CSSStyleSheet = function(payload) … … 757 902 } 758 903 904 /** 905 * @param {CSSAgent.StyleSheetId} styleSheetId 906 * @param {function(?WebInspector.CSSStyleSheet)} userCallback 907 */ 759 908 WebInspector.CSSStyleSheet.createForId = function(styleSheetId, userCallback) 760 909 { 910 /** 911 * @param {?string} error 912 * @param {CSSAgent.CSSStyleSheetBody} styleSheetPayload 913 */ 761 914 function callback(error, styleSheetPayload) 762 915 { … … 770 923 771 924 WebInspector.CSSStyleSheet.prototype = { 925 /** 926 * @return {string|undefined} 927 */ 772 928 getText: function() 773 929 { … … 775 931 }, 776 932 933 /** 934 * @param {string} newText 935 * @param {boolean} majorChange 936 * @param {function(?string)=} userCallback 937 */ 777 938 setText: function(newText, majorChange, userCallback) 778 939 { 940 /** 941 * @param {?string} error 942 */ 779 943 function callback(error) 780 944 { … … 807 971 808 972 WebInspector.CSSStyleModelResourceBinding.prototype = { 973 /** 974 * @param {WebInspector.Resource} resource 975 * @param {string} content 976 * @param {boolean} majorChange 977 * @param {function(?string)} userCallback 978 */ 809 979 setContent: function(resource, content, majorChange, userCallback) 810 980 { … … 819 989 }, 820 990 991 /** 992 * @return {boolean} 993 */ 821 994 canSetContent: function() 822 995 { … … 824 997 }, 825 998 999 /** 1000 * @param {WebInspector.Event} event 1001 */ 826 1002 _inspectedURLChanged: function(event) 827 1003 { … … 831 1007 }, 832 1008 1009 /** 1010 * @param {string} url 1011 * @param {string} content 1012 * @param {boolean} majorChange 1013 * @param {function(?string)} userCallback 1014 * @param {?string} error 1015 */ 833 1016 _innerSetContent: function(url, content, majorChange, userCallback, error) 834 1017 { … … 840 1023 var styleSheetId = this._urlToStyleSheetId[url]; 841 1024 if (!styleSheetId) { 842 if (userCallback) 843 userCallback("No stylesheet found: " + url); 1025 userCallback("No stylesheet found: " + url); 844 1026 return; 845 1027 } … … 848 1030 function callbackWrapper(error) 849 1031 { 850 if (userCallback) 851 userCallback(error); 1032 userCallback(error); 852 1033 delete this._isSettingContent; 853 1034 } … … 855 1036 }, 856 1037 1038 /** 1039 * @param {function(?string)} callback 1040 */ 857 1041 _loadStyleSheetHeaders: function(callback) 858 1042 { 1043 /** 1044 * @param {?string} error 1045 * @param {Array.<CSSAgent.CSSStyleSheetHeader>} infos 1046 */ 859 1047 function didGetAllStyleSheets(error, infos) 860 1048 { … … 869 1057 this._styleSheetIdToURL[info.styleSheetId] = info.sourceURL; 870 1058 } 871 callback( );1059 callback(null); 872 1060 } 873 1061 CSSAgent.getAllStyleSheets(didGetAllStyleSheets.bind(this)); 874 1062 }, 875 1063 1064 /** 1065 * @param {WebInspector.Event} event 1066 */ 876 1067 _styleSheetChanged: function(event) 877 1068 { … … 882 1073 return; 883 1074 1075 /** 1076 * @param {?string} error 1077 * @param {string} content 1078 */ 884 1079 function callback(error, content) 885 1080 { … … 890 1085 }, 891 1086 1087 /** 1088 * @param {CSSAgent.StyleSheetId} styleSheetId 1089 * @param {string} content 1090 */ 892 1091 _innerStyleSheetChanged: function(styleSheetId, content) 893 1092 { … … 929 1128 }, 930 1129 1130 /** 1131 * @param {CSSAgent.StyleSheetId} styleSheetId 1132 */ 931 1133 styleSheetChanged: function(styleSheetId) 932 1134 {
Note:
See TracChangeset
for help on using the changeset viewer.