Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Remove CSS Rect #71

Merged
merged 1 commit into from
Jul 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 0 additions & 105 deletions sky/engine/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -102,113 +102,8 @@ namespace blink {
{{convert_and_set_value(property)}}
}
{% endmacro %}
{{apply_auto('CSSPropertyClip')}}
{{apply_auto('CSSPropertyZIndex')}}

static bool lengthTypeAndValueMatch(const Length& length, LengthType type, float value)
{
return length.type() == type && length.value() == value;
}

static bool lengthTypeAndValueMatch(const LengthBox& lengthBox, LengthType type, float value)
{
return (lengthTypeAndValueMatch(lengthBox.left(), type, value)
&& lengthTypeAndValueMatch(lengthBox.right(), type, value)
&& lengthTypeAndValueMatch(lengthBox.top(), type, value)
&& lengthTypeAndValueMatch(lengthBox.bottom(), type, value));
}

static bool lengthTypeAndValueMatch(const BorderImageLength& borderImageLength, LengthType type, float value)
{
return borderImageLength.isLength() && lengthTypeAndValueMatch(borderImageLength.length(), type, value);
}

static bool lengthTypeAndValueMatch(const BorderImageLengthBox& borderImageLengthBox, LengthType type, float value)
{
return (lengthTypeAndValueMatch(borderImageLengthBox.left(), type, value)
&& lengthTypeAndValueMatch(borderImageLengthBox.right(), type, value)
&& lengthTypeAndValueMatch(borderImageLengthBox.top(), type, value)
&& lengthTypeAndValueMatch(borderImageLengthBox.bottom(), type, value));
}

{% macro apply_border_image_modifier(property_id, modifier_type) %}
{{ declare_initial_function(property_id) }}
{
const NinePieceImage& currentImage = state.style()->borderImage();
{# Check for equality in case we can bail out before creating a new NinePieceImage. #}
{% if modifier_type == 'Outset' %}
if (lengthTypeAndValueMatch(currentImage.outset(), Fixed, 0))
return;
{% elif modifier_type == 'Repeat' %}
if (currentImage.horizontalRule() == StretchImageRule && currentImage.verticalRule() == StretchImageRule)
return;
{% elif modifier_type == 'Slice' %}
if (currentImage.fill() == false && lengthTypeAndValueMatch(currentImage.imageSlices(), Percent, 100))
return;
{% elif modifier_type == 'Width' %}
if (lengthTypeAndValueMatch(currentImage.borderSlices(), Fixed, 1))
return;
{% endif %}

NinePieceImage image(currentImage);
{% if modifier_type == 'Outset' %}
image.setOutset(Length(0, Fixed));
{% elif modifier_type == 'Repeat' %}
image.setHorizontalRule(StretchImageRule);
image.setVerticalRule(StretchImageRule);
{% elif modifier_type == 'Slice' %}
image.setImageSlices(LengthBox({{ (['Length(100, Percent)']*4) | join(', ') }}));
image.setFill(false);
{% elif modifier_type == 'Width' %}
image.setBorderSlices(1.0);
{% endif %}
state.style()->setBorderImage(image);
}

{{declare_inherit_function(property_id)}}
{
NinePieceImage image(state.style()->borderImage());
{% if modifier_type == 'Outset' %}
image.copyOutsetFrom(state.parentStyle()->borderImage());
{% elif modifier_type == 'Repeat' %}
image.copyRepeatFrom(state.parentStyle()->borderImage());
{% elif modifier_type == 'Slice' %}
image.copyImageSlicesFrom(state.parentStyle()->borderImage());
{% elif modifier_type == 'Width' %}
image.copyBorderSlicesFrom(state.parentStyle()->borderImage());
{% endif %}
state.style()->setBorderImage(image);
}

{{declare_value_function(property_id)}}
{
NinePieceImage image(state.style()->borderImage());
{% if modifier_type == 'Outset' %}
image.setOutset(state.styleMap().mapNinePieceImageQuad(value));
{% elif modifier_type == 'Repeat' %}
state.styleMap().mapNinePieceImageRepeat(value, image);
{% elif modifier_type == 'Slice' %}
state.styleMap().mapNinePieceImageSlice(value, image);
{% elif modifier_type == 'Width' %}
image.setBorderSlices(state.styleMap().mapNinePieceImageQuad(value));
{% endif %}
state.style()->setBorderImage(image);
}
{% endmacro %}
{{apply_border_image_modifier('CSSPropertyBorderImageOutset', 'Outset')}}
{{apply_border_image_modifier('CSSPropertyBorderImageRepeat', 'Repeat')}}
{{apply_border_image_modifier('CSSPropertyBorderImageSlice', 'Slice')}}
{{apply_border_image_modifier('CSSPropertyBorderImageWidth', 'Width')}}

{% macro apply_value_border_image_source(property_id) %}
{{declare_value_function(property_id)}}
{
{% set property = properties[property_id] %}
{{set_value(property)}}(state.styleImage({{property_id}}, value));
}
{% endmacro %}
{{apply_value_border_image_source('CSSPropertyBorderImageSource')}}

{% macro apply_color(property_id, initial_color='StyleColor::currentColor') %}
{% set property = properties[property_id] %}
{{declare_initial_function(property_id)}}
Expand Down
10 changes: 0 additions & 10 deletions sky/engine/core/core.gni
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ sky_core_files = [
"css/CSSAspectRatioValue.h",
"css/CSSBasicShapes.cpp",
"css/CSSBasicShapes.h",
"css/CSSBorderImage.cpp",
"css/CSSBorderImage.h",
"css/CSSBorderImageSliceValue.cpp",
"css/CSSBorderImageSliceValue.h",
"css/CSSCalculationValue.cpp",
"css/CSSCalculationValue.h",
"css/CSSComputedStyleDeclaration.cpp",
Expand Down Expand Up @@ -126,8 +122,6 @@ sky_core_files = [
"css/PropertySetCSSStyleDeclaration.h",
"css/RGBColor.cpp",
"css/RGBColor.h",
"css/Rect.cpp",
"css/Rect.h",
"css/RuleFeature.cpp",
"css/RuleFeature.h",
"css/RuleSet.cpp",
Expand Down Expand Up @@ -682,8 +676,6 @@ sky_core_files = [
"rendering/style/BasicShapes.cpp",
"rendering/style/BasicShapes.h",
"rendering/style/BorderData.h",
"rendering/style/BorderImageLength.h",
"rendering/style/BorderImageLengthBox.h",
"rendering/style/BorderValue.h",
"rendering/style/CollapsedBorderValue.h",
"rendering/style/CounterDirectives.cpp",
Expand All @@ -692,8 +684,6 @@ sky_core_files = [
"rendering/style/DataRef.h",
"rendering/style/FillLayer.cpp",
"rendering/style/FillLayer.h",
"rendering/style/NinePieceImage.cpp",
"rendering/style/NinePieceImage.h",
"rendering/style/OutlineValue.h",
"rendering/style/RenderStyle.cpp",
"rendering/style/RenderStyle.h",
Expand Down
50 changes: 0 additions & 50 deletions sky/engine/core/css/CSSBorderImage.cpp

This file was deleted.

34 changes: 0 additions & 34 deletions sky/engine/core/css/CSSBorderImage.h

This file was deleted.

55 changes: 0 additions & 55 deletions sky/engine/core/css/CSSBorderImageSliceValue.cpp

This file was deleted.

63 changes: 0 additions & 63 deletions sky/engine/core/css/CSSBorderImageSliceValue.h

This file was deleted.

2 changes: 0 additions & 2 deletions sky/engine/core/css/CSSCalculationValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,11 @@ static bool hasDoubleValue(CSSPrimitiveValue::UnitType type)
case CSSPrimitiveValue::CSS_URI:
case CSSPrimitiveValue::CSS_IDENT:
case CSSPrimitiveValue::CSS_ATTR:
case CSSPrimitiveValue::CSS_RECT:
case CSSPrimitiveValue::CSS_RGBCOLOR:
case CSSPrimitiveValue::CSS_PAIR:
case CSSPrimitiveValue::CSS_UNICODE_RANGE:
case CSSPrimitiveValue::CSS_PARSER_HEXCOLOR:
case CSSPrimitiveValue::CSS_SHAPE:
case CSSPrimitiveValue::CSS_QUAD:
case CSSPrimitiveValue::CSS_CALC:
case CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_NUMBER:
case CSSPrimitiveValue::CSS_CALC_PERCENTAGE_WITH_LENGTH:
Expand Down
Loading