Repository: flex-asjs Updated Branches: refs/heads/develop 38cf88289 -> d2cc69432
also allow styles to prevent sizing to content Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/65b7cb25 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/65b7cb25 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/65b7cb25 Branch: refs/heads/develop Commit: 65b7cb25e0601c379633d8e96cf8989f5c66995c Parents: 38cf882 Author: Alex Harui <[email protected]> Authored: Mon May 4 08:38:51 2015 -0700 Committer: Alex Harui <[email protected]> Committed: Thu May 7 17:33:52 2015 -0700 ---------------------------------------------------------------------- .../as/src/org/apache/flex/core/IStyleableObject.as | 12 ++++++++++++ .../src/org/apache/flex/core/SimpleCSSValuesImpl.as | 12 ++++++++++++ .../Core/as/src/org/apache/flex/core/UIBase.as | 15 +++++++++++++-- .../as/src/org/apache/flex/html/beads/ImageView.as | 4 ++-- 4 files changed, 39 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65b7cb25/frameworks/projects/Core/as/src/org/apache/flex/core/IStyleableObject.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/IStyleableObject.as b/frameworks/projects/Core/as/src/org/apache/flex/core/IStyleableObject.as index 9bc9c5d..e4071e5 100644 --- a/frameworks/projects/Core/as/src/org/apache/flex/core/IStyleableObject.as +++ b/frameworks/projects/Core/as/src/org/apache/flex/core/IStyleableObject.as @@ -46,6 +46,18 @@ package org.apache.flex.core function set className(value:String):void; /** + * Get the id that will be used to + * choose id selectors in most CSS style + * implementations. + * + * @langversion 3.0 + * @playerversion Flash 10.2 + * @playerversion AIR 2.6 + * @productversion FlexJS 0.0 + */ + function get id():String; + + /** * Get the object containing styles * for this object. * http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65b7cb25/frameworks/projects/Core/as/src/org/apache/flex/core/SimpleCSSValuesImpl.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/SimpleCSSValuesImpl.as b/frameworks/projects/Core/as/src/org/apache/flex/core/SimpleCSSValuesImpl.as index 04855f1..4e4bbaf 100644 --- a/frameworks/projects/Core/as/src/org/apache/flex/core/SimpleCSSValuesImpl.as +++ b/frameworks/projects/Core/as/src/org/apache/flex/core/SimpleCSSValuesImpl.as @@ -292,6 +292,18 @@ package org.apache.flex.core if (value !== undefined) return value; } + if (styleable.id != null) + { + o = values["#" + styleable.id]; + if (o) + { + value = o[valueName]; + if (value == "inherit") + return getInheritingValue(thisObject, valueName, state, attrs); + if (value !== undefined) + return value; + } + } className = styleable.className; if (state) { http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65b7cb25/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as b/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as index fc28ffc..2f8bca1 100644 --- a/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as +++ b/frameworks/projects/Core/as/src/org/apache/flex/core/UIBase.as @@ -513,7 +513,13 @@ package org.apache.flex.core */ public function isWidthSizedToContent():Boolean { - return (isNaN(_explicitWidth) && isNaN(_percentWidth)); + if (!isNaN(_explicitWidth)) + return false; + if (!isNaN(_percentWidth)) + return false; + var value:* = ValuesManager.valuesImpl.getValue(this, "width"); + return value === undefined; + } /** @@ -526,7 +532,12 @@ package org.apache.flex.core */ public function isHeightSizedToContent():Boolean { - return (isNaN(_explicitHeight) && isNaN(_percentHeight)); + if (!isNaN(_explicitHeight)) + return false; + if (!isNaN(_percentHeight)) + return false; + var value:* = ValuesManager.valuesImpl.getValue(this, "height"); + return value === undefined; } /** http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/65b7cb25/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ImageView.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ImageView.as b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ImageView.as index c218006..95ed077 100644 --- a/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ImageView.as +++ b/frameworks/projects/HTML/as/src/org/apache/flex/html/beads/ImageView.as @@ -110,12 +110,12 @@ package org.apache.flex.html.beads host.addChild(bitmap); - if (isNaN(host.explicitWidth) && isNaN(host.percentWidth)) + if (host.isWidthSizedToContent()) host.dispatchEvent(new Event("widthChanged")); else bitmap.width = UIBase(_strand).width; - if (isNaN(host.explicitHeight) && isNaN(host.percentHeight)) + if (host.isHeightSizedToContent()) host.dispatchEvent(new Event("heightChanged")); else bitmap.height = UIBase(_strand).height;
