1- import { AlignSelf , Flex , FlexFlow , FlexGrow , FlexShrink , FlexWrapBefore , Order } from '../../layouts/flexbox-layout' ;
1+ import { AlignSelf , FlexGrow , FlexShrink , FlexWrapBefore , Order } from '../../layouts/flexbox-layout' ;
22import { Page } from '../../page' ;
33import { CoreTypes , Trace } from '../../styling/styling-shared' ;
44import { Property , CssProperty , CssAnimationProperty , InheritedProperty , clearInheritedProperties , propagateInheritableProperties , propagateInheritableCssProperties , initNativeView } from '../properties' ;
@@ -8,12 +8,10 @@ import { Binding } from '../bindable';
88import { BindingOptions } from '../bindable/bindable-types' ;
99import { Observable , PropertyChangeData , WrappedValue } from '../../../data/observable' ;
1010import { Style } from '../../styling/style' ;
11- import { paddingTopProperty , paddingRightProperty , paddingBottomProperty , paddingLeftProperty } from '../../styling/style-properties' ;
1211import type { ModalTransition } from '../../transition/modal-transition' ;
1312
1413// TODO: Remove this import!
1514import { getClass } from '../../../utils/types' ;
16- import { unsetValue } from '../properties/property-shared' ;
1715
1816import { profile } from '../../../profiling' ;
1917
@@ -339,6 +337,17 @@ export abstract class ViewBase extends Observable {
339337 private _style : Style ;
340338 private _isLoaded : boolean ;
341339
340+ private _effectivePaddingTop : number = null ;
341+ private _effectivePaddingRight : number = null ;
342+ private _effectivePaddingBottom : number = null ;
343+ private _effectivePaddingLeft : number = null ;
344+
345+ protected _defaultPaddingTop : number = 0 ;
346+ protected _defaultPaddingRight : number = 0 ;
347+ protected _defaultPaddingBottom : number = 0 ;
348+ protected _defaultPaddingLeft : number = 0 ;
349+ protected _isPaddingRelative : boolean ;
350+
342351 /**
343352 * @deprecated
344353 */
@@ -527,21 +536,11 @@ export abstract class ViewBase extends Observable {
527536 public effectiveMarginRight : number ;
528537 public effectiveMarginBottom : number ;
529538 public effectiveMarginLeft : number ;
530- public effectivePaddingTop : number ;
531- public effectivePaddingRight : number ;
532- public effectivePaddingBottom : number ;
533- public effectivePaddingLeft : number ;
534539 public effectiveBorderTopWidth : number ;
535540 public effectiveBorderRightWidth : number ;
536541 public effectiveBorderBottomWidth : number ;
537542 public effectiveBorderLeftWidth : number ;
538543
539- public _defaultPaddingTop : number ;
540- public _defaultPaddingRight : number ;
541- public _defaultPaddingBottom : number ;
542- public _defaultPaddingLeft : number ;
543- public _isPaddingRelative : boolean ;
544-
545544 /**
546545 * @private
547546 * Module name when the view is a module root. Otherwise, it is undefined.
@@ -637,6 +636,38 @@ export abstract class ViewBase extends Observable {
637636 this . className = v ;
638637 }
639638
639+ get effectivePaddingTop ( ) : number {
640+ return this . _effectivePaddingTop != null ? this . _effectivePaddingTop : this . _defaultPaddingTop ;
641+ }
642+ set effectivePaddingTop ( v : number ) {
643+ this . _effectivePaddingTop = v ;
644+ }
645+
646+ get effectivePaddingRight ( ) : number {
647+ return this . _effectivePaddingRight != null ? this . _effectivePaddingRight : this . _defaultPaddingRight ;
648+ }
649+ set effectivePaddingRight ( v : number ) {
650+ this . _effectivePaddingRight = v ;
651+ }
652+
653+ get effectivePaddingBottom ( ) : number {
654+ return this . _effectivePaddingBottom != null ? this . _effectivePaddingBottom : this . _defaultPaddingBottom ;
655+ }
656+ set effectivePaddingBottom ( v : number ) {
657+ this . _effectivePaddingBottom = v ;
658+ }
659+
660+ get effectivePaddingLeft ( ) : number {
661+ return this . _effectivePaddingLeft != null ? this . _effectivePaddingLeft : this . _defaultPaddingLeft ;
662+ }
663+ set effectivePaddingLeft ( v : number ) {
664+ this . _effectivePaddingLeft = v ;
665+ }
666+
667+ getEffectivePaddingShorthand ( ) : string {
668+ return `${ this . effectivePaddingTop } ${ this . effectivePaddingRight } ${ this . effectivePaddingBottom } ${ this . effectivePaddingLeft } ` ;
669+ }
670+
640671 /**
641672 * Returns the child view with the specified id.
642673 */
@@ -724,6 +755,10 @@ export abstract class ViewBase extends Observable {
724755 }
725756 }
726757
758+ public _setDefaultPaddings ( insets : any ) : void {
759+ // Overridden
760+ }
761+
727762 public _suspendNativeUpdates ( type : SuspendType ) : void {
728763 if ( type ) {
729764 this . _suspendNativeUpdatesCount = this . _suspendNativeUpdatesCount | type ;
@@ -1176,24 +1211,7 @@ export abstract class ViewBase extends Observable {
11761211 nativeView . defaultPaddings = DEFAULT_VIEW_PADDINGS . get ( className ) ;
11771212 }
11781213
1179- this . _defaultPaddingTop = result . top ;
1180- this . _defaultPaddingRight = result . right ;
1181- this . _defaultPaddingBottom = result . bottom ;
1182- this . _defaultPaddingLeft = result . left ;
1183-
1184- const style = this . style ;
1185- if ( ! paddingTopProperty . isSet ( style ) ) {
1186- this . effectivePaddingTop = this . _defaultPaddingTop ;
1187- }
1188- if ( ! paddingRightProperty . isSet ( style ) ) {
1189- this . effectivePaddingRight = this . _defaultPaddingRight ;
1190- }
1191- if ( ! paddingBottomProperty . isSet ( style ) ) {
1192- this . effectivePaddingBottom = this . _defaultPaddingBottom ;
1193- }
1194- if ( ! paddingLeftProperty . isSet ( style ) ) {
1195- this . effectivePaddingLeft = this . _defaultPaddingLeft ;
1196- }
1214+ this . _setDefaultPaddings ( result ) ;
11971215 }
11981216 }
11991217 } else {
@@ -1536,18 +1554,10 @@ ViewBase.prototype.effectiveMarginTop = 0;
15361554ViewBase . prototype . effectiveMarginRight = 0 ;
15371555ViewBase . prototype . effectiveMarginBottom = 0 ;
15381556ViewBase . prototype . effectiveMarginLeft = 0 ;
1539- ViewBase . prototype . effectivePaddingTop = 0 ;
1540- ViewBase . prototype . effectivePaddingRight = 0 ;
1541- ViewBase . prototype . effectivePaddingBottom = 0 ;
1542- ViewBase . prototype . effectivePaddingLeft = 0 ;
15431557ViewBase . prototype . effectiveBorderTopWidth = 0 ;
15441558ViewBase . prototype . effectiveBorderRightWidth = 0 ;
15451559ViewBase . prototype . effectiveBorderBottomWidth = 0 ;
15461560ViewBase . prototype . effectiveBorderLeftWidth = 0 ;
1547- ViewBase . prototype . _defaultPaddingTop = 0 ;
1548- ViewBase . prototype . _defaultPaddingRight = 0 ;
1549- ViewBase . prototype . _defaultPaddingBottom = 0 ;
1550- ViewBase . prototype . _defaultPaddingLeft = 0 ;
15511561ViewBase . prototype . _isViewBase = true ;
15521562ViewBase . prototype . recycleNativeView = 'never' ;
15531563ViewBase . prototype . reusable = false ;
0 commit comments