Package com.volantis.mcs.css.version

Examples of com.volantis.mcs.css.version.CSSVersion


            // We can emulate the styles - check if we need to...
            DeviceElementCapability dec = deviceCapabilityManager.
                    getDeviceElementCapability("marquee", true);

            boolean supportsDisplayKeyword;
            final CSSVersion cssVersion = getCssVersion();
            if (cssVersion == null) {
                supportsDisplayKeyword = false;
            } else {
                CSSProperty display = cssVersion.getProperty(
                        StylePropertyDetails.DISPLAY);
                // In for the marquee css properties to have an effect, the
                // display must be set to marquee. If this keyword isn't
                // supported, then all marquee properties must be emulated.
                supportsDisplayKeyword = display.supportsKeyword(
                        DisplayKeywords.MCS_MARQUEE);
            }

            // The value of mcs-marquee-style determines if the other marquee
            // styles apply. So, if the mcs-marquee-style property css isn't
            // supported by the device, then we need to emulate all of the
            // others in order to display the requested marquee effects.
            boolean marqueeStyleCssSupported = supportsDisplayKeyword &&
                    cssVersion.getProperty(
                            StylePropertyDetails.MCS_MARQUEE_STYLE) != null;
            boolean behaviourSupported = CapabilitySupportLevel.FULL.equals(
                    dec.getSupportType(DeviceCapabilityConstants.MARQUEE_BEHAVIOR_ATT));
            // Emulate only if the css is not supported, and the attribute is.
            if (!marqueeStyleCssSupported && behaviourSupported) {

                // This renderer must be added before the other marquee
                // renderers; it ensures there is a marquee element, and the
                // others will not add attribute values to any other element
                AttributeAndOrElementStyleEmulationPropertyRenderer renderer =
                        new AttributeAndOrElementStyleEmulationPropertyRenderer(
                                new MarqueeEmulationRenderer(
                                        DeviceCapabilityConstants.MARQUEE_BEHAVIOR_ATT, false));
                styleEmulationPropertyRendererSelector.register(
                        StylePropertyDetails.MCS_MARQUEE_STYLE, renderer);

                // If we're going to be rendering this element, then need
                // to support it when transforming...
                fakePermittedChildren.add("marquee");


                // The rest of the marquee styles must be emulated if the
                // marquee style is emulated (and cannot be if it is not).

                // Marquee repetition.
                boolean marqueeLoopCssSupported = marqueeStyleCssSupported &&
                        (cssVersion.getProperty(
                                StylePropertyDetails.MCS_MARQUEE_REPETITION) != null);
                boolean loopSupported = CapabilitySupportLevel.FULL.equals(
                        dec.getSupportType(DeviceCapabilityConstants.MARQUEE_LOOP_ATT));
                if (!marqueeLoopCssSupported && loopSupported) {

                    AttributeAndOrElementStyleEmulationPropertyRenderer loopRenderer =
                            new AttributeAndOrElementStyleEmulationPropertyRenderer(
                                    new MarqueeEmulationAttributePropertyRenderer(
                                            DeviceCapabilityConstants.MARQUEE_LOOP_ATT, false));
                    styleEmulationPropertyRendererSelector.register(
                            StylePropertyDetails.MCS_MARQUEE_REPETITION,
                            loopRenderer);
                }

                // Marquee direction.
                boolean marqueeDirCssSupported = marqueeStyleCssSupported &&
                        (cssVersion.getProperty(StylePropertyDetails.MCS_MARQUEE_DIRECTION) != null);
                boolean directionSupported = CapabilitySupportLevel.FULL.equals(
                        dec.getSupportType(DeviceCapabilityConstants.MARQUEE_DIRECTION_ATT));
                if (!marqueeDirCssSupported && directionSupported) {

                    AttributeAndOrElementStyleEmulationPropertyRenderer dirRenderer =
View Full Code Here


    protected WalkingDOMVisitor getWalkingDOMVisitor(DOMProtocol protocol) {

        final ProtocolConfiguration configuration =
                protocol.getProtocolConfiguration();

        CSSVersion cssVersion = null;

        if (null != configuration) {
            cssVersion = configuration.getCssVersion();
        }
View Full Code Here

        // Tell log4j to log everything for your test packages.
        category.setLevel(Level.ALL);

        final String ssversion = DevicePolicyConstants.CSS_WAP;
        DefaultDevice device = createDevice("Master", ssversion, null);
        CSSVersion cssVersion;

        // Test the default setup for CSSWAP.
        cssConfigurator.initialise(config,
            INTERNAL_DEVICE_FACTORY.createInternalDevice(device));
        cssVersion = config.getCssVersion();
        // It should not have margin.
        assertFalse(cssVersion.supportsShorthand(StyleShorthands.MARGIN));
        // It should have font.
        assertTrue(cssVersion.supportsShorthand(StyleShorthands.FONT));

        // Add margin and test again
        final Map policies = new HashMap();
        policies.put("ssversion", ssversion);
        policies.put("x-css.shorthands.margin.support", "full");
        device = createDevice("Master", policies, null);
        cssConfigurator.initialise(config,
            INTERNAL_DEVICE_FACTORY.createInternalDevice(device));
        cssVersion = config.getCssVersion();
        // It should have margin now.
        assertTrue(cssVersion.supportsShorthand(StyleShorthands.MARGIN));
        // It should still have font.
        assertTrue(cssVersion.supportsShorthand(StyleShorthands.FONT));
    }
View Full Code Here

        // Tell log4j to log everything for your test packages.
        category.setLevel(Level.ALL);

        final String ssversion = DevicePolicyConstants.CSS_WAP;
        DefaultDevice device = createDevice("Master", ssversion, null);
        CSSVersion cssVersion;

        // Test the default setup for CSSWAP.
        cssConfigurator.initialise(config,
            INTERNAL_DEVICE_FACTORY.createInternalDevice(device));
        cssVersion = config.getCssVersion();

        // It should support the color.triplets syntax by default (explicitly
        // added in the CSS*VersionFactory).
        assertTrue(cssVersion.supportsSyntax(StyleSyntaxes.COLOR_TRIPLETS));

        // Explicitly add full support for the color.triplets syntax and
        // test again.
        final Map policies = new HashMap();
        policies.put("ssversion", ssversion);
        policies.put(COLOR_TRIPLETS, "full");
        device = createDevice("Master", policies, null);
        cssConfigurator.initialise(config,
            INTERNAL_DEVICE_FACTORY.createInternalDevice(device));
        cssVersion = config.getCssVersion();

        // It should have syntax values now.
        assertTrue(cssVersion.supportsSyntax(StyleSyntaxes.COLOR_TRIPLETS));

        // Explicitly set color.triplets syntax support to none and test again
        policies.put(COLOR_TRIPLETS, "none");
        device = createDevice("Master", policies, null);
        cssConfigurator.initialise(config,
            INTERNAL_DEVICE_FACTORY.createInternalDevice(device));
        cssVersion = config.getCssVersion();

        // It should have syntax values now.
        assertFalse(cssVersion.supportsSyntax(StyleSyntaxes.COLOR_TRIPLETS));
    }
View Full Code Here

        // Tell log4j to log everything for your test packages.
        category.setLevel(Level.ALL);

        final String ssversion = DevicePolicyConstants.CSS_WAP;
        DefaultDevice device = createDevice("Master", ssversion, null);
        CSSVersion cssVersion;

        // Test the default setup for CSSWAP.
        cssConfigurator.initialise(config,
               INTERNAL_DEVICE_FACTORY.createInternalDevice(device));
        cssVersion = config.getCssVersion();
        // It should not have hover.
        assertFalse(cssVersion.supportsPseudoSelectorId("hover"));
        // It should have link.
        assertTrue(cssVersion.supportsPseudoSelectorId("link"));

        // Add support for hover and test again
        final Map policies = new HashMap();
        policies.put("ssversion", DevicePolicyConstants.CSS2);
        policies.put("x-css.selectors.hover.support", "full");
        device = createDevice("Master", policies, null);
        cssConfigurator.initialise(config,
               INTERNAL_DEVICE_FACTORY.createInternalDevice(device));
        cssVersion = config.getCssVersion();
        // It should have hover now.
        assertTrue(cssVersion.supportsPseudoSelectorId("hover"));
        // It should still have link.
        assertTrue(cssVersion.supportsPseudoSelectorId("link"));
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.css.version.CSSVersion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.