private static bool ProcessAllSpecifiedProperties(IList <String> props, IDictionary <CssBackgroundUtils.BackgroundPropertyType , String> resolvedProps, ICollection <CssBackgroundUtils.BackgroundPropertyType> usedTypes) { IList <String> boxValues = new List <String>(); bool slashEncountered = false; bool propertyProcessedCorrectly = true; foreach (String value in props) { int slashCharInd = value.IndexOf('/'); if (slashCharInd > 0 && slashCharInd < value.Length - 1 && !slashEncountered && !value.Contains("url(")) { slashEncountered = true; propertyProcessedCorrectly = ProcessValueWithSlash(value, slashCharInd, resolvedProps, usedTypes); } else { CssBackgroundUtils.BackgroundPropertyType type = CssBackgroundUtils.ResolveBackgroundPropertyType(value); if (CssBackgroundUtils.BackgroundPropertyType.BACKGROUND_ORIGIN_OR_CLIP == type) { boxValues.Add(value); } else { propertyProcessedCorrectly = PutPropertyBasedOnType(ChangePropertyType(type, slashEncountered), value, resolvedProps , usedTypes); } } if (!propertyProcessedCorrectly) { return(false); } } return(AddBackgroundClipAndBackgroundOriginBoxValues(boxValues, resolvedProps, usedTypes)); }
private bool IsPropertyValueCorrespondsPropertyType(String value) { CssBackgroundUtils.BackgroundPropertyType propertyType = CssBackgroundUtils.ResolveBackgroundPropertyType( value); if (propertyType == CssBackgroundUtils.BackgroundPropertyType.UNDEFINED) { return(false); } if (CssBackgroundUtils.GetBackgroundPropertyNameFromType(propertyType).Equals(backgroundProperty)) { return(true); } if (propertyType == CssBackgroundUtils.BackgroundPropertyType.BACKGROUND_POSITION && (CommonCssConstants.BACKGROUND_POSITION_X .Equals(backgroundProperty) || CommonCssConstants.BACKGROUND_POSITION_Y.Equals(backgroundProperty))) { return(true); } if (propertyType == CssBackgroundUtils.BackgroundPropertyType.BACKGROUND_ORIGIN_OR_CLIP && (CommonCssConstants .BACKGROUND_CLIP.Equals(backgroundProperty) || CommonCssConstants.BACKGROUND_ORIGIN.Equals(backgroundProperty ))) { return(true); } return(propertyType == CssBackgroundUtils.BackgroundPropertyType.BACKGROUND_POSITION_OR_SIZE && (CommonCssConstants .BACKGROUND_POSITION_X.Equals(backgroundProperty) || CommonCssConstants.BACKGROUND_POSITION_Y.Equals(backgroundProperty ) || CommonCssConstants.BACKGROUND_SIZE.Equals(backgroundProperty))); }
private static bool ProcessValueWithSlash(String value, int slashCharInd, IDictionary <CssBackgroundUtils.BackgroundPropertyType , String> resolvedProps, ICollection <CssBackgroundUtils.BackgroundPropertyType> usedTypes) { String value1 = value.JSubstring(0, slashCharInd); CssBackgroundUtils.BackgroundPropertyType typeBeforeSlash = ChangePropertyType(CssBackgroundUtils.ResolveBackgroundPropertyType (value1), false); if (typeBeforeSlash != CssBackgroundUtils.BackgroundPropertyType.BACKGROUND_POSITION && typeBeforeSlash != CssBackgroundUtils.BackgroundPropertyType.BACKGROUND_POSITION_OR_SIZE) { LOGGER.Error(MessageFormatUtil.Format(iText.StyledXmlParser.LogMessageConstant.UNKNOWN_PROPERTY, CommonCssConstants .BACKGROUND_POSITION, value1)); return(false); } String value2 = value.Substring(slashCharInd + 1); CssBackgroundUtils.BackgroundPropertyType typeAfterSlash = ChangePropertyType(CssBackgroundUtils.ResolveBackgroundPropertyType (value2), true); if (typeAfterSlash != CssBackgroundUtils.BackgroundPropertyType.BACKGROUND_SIZE && typeAfterSlash != CssBackgroundUtils.BackgroundPropertyType .BACKGROUND_POSITION_OR_SIZE) { LOGGER.Error(MessageFormatUtil.Format(iText.StyledXmlParser.LogMessageConstant.UNKNOWN_PROPERTY, CommonCssConstants .BACKGROUND_SIZE, value2)); return(false); } return(PutPropertyBasedOnType(typeBeforeSlash, value1, resolvedProps, usedTypes) && PutPropertyBasedOnType (typeAfterSlash, value2, resolvedProps, usedTypes)); }