Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Unified Diff: Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl

Issue 1153353002: Fast path when setting border-image-width to initial always fails (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: properly naming methods Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
diff --git a/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl b/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
index da95da69b3f99c926d7968be98e19f9dd816f8fe..29c660e30ba771b0d339df77d4e8c0e124cbd314 100644
--- a/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
+++ b/Source/build/scripts/templates/StyleBuilderFunctions.cpp.tmpl
@@ -157,30 +157,20 @@ namespace blink {
{{apply_auto('CSSPropertyWidows')}}
{{apply_auto('CSSPropertyZIndex')}}
-static bool lengthTypeAndValueMatch(const Length& length, LengthType type, float value)
+static bool lengthMatchesAllSides(const LengthBox& lengthBox, const Length& length)
{
- return length.type() == type && length.value() == value;
+ return (lengthBox.left() == length
+ && lengthBox.right() == length
+ && lengthBox.top() == length
+ && lengthBox.bottom() == length);
}
-static bool lengthTypeAndValueMatch(const LengthBox& lengthBox, LengthType type, float value)
+static bool borderImageLengthMatchesAllSides(const BorderImageLengthBox& borderImageLengthBox, const BorderImageLength& borderImageLength)
{
- 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));
+ return (borderImageLengthBox.left() == borderImageLength
+ && borderImageLengthBox.right() == borderImageLength
+ && borderImageLengthBox.top() == borderImageLength
+ && borderImageLengthBox.bottom() == borderImageLength);
}
{% macro apply_border_image_modifier(property_id, modifier_type) %}
@@ -192,24 +182,24 @@ static bool lengthTypeAndValueMatch(const BorderImageLengthBox& borderImageLengt
const NinePieceImage& currentImage = state.style()->{{getter}}();
{# Check for equality in case we can bail out before creating a new NinePieceImage. #}
{% if modifier_type == 'Outset' %}
- if (lengthTypeAndValueMatch(currentImage.outset(), Fixed, 0))
+ if (borderImageLengthMatchesAllSides(currentImage.outset(), BorderImageLength(Length(0, Fixed))))
return;
{% elif modifier_type == 'Repeat' %}
if (currentImage.horizontalRule() == StretchImageRule && currentImage.verticalRule() == StretchImageRule)
return;
{% elif modifier_type == 'Slice' and is_mask_box %}
// Masks have a different initial value for slices. Preserve the value of 0 for backwards compatibility.
- if (currentImage.fill() == true && lengthTypeAndValueMatch(currentImage.imageSlices(), Fixed, 0))
+ if (currentImage.fill() == true && lengthMatchesAllSides(currentImage.imageSlices(), Length(0, Fixed)))
return;
{% elif modifier_type == 'Slice' and not is_mask_box %}
- if (currentImage.fill() == false && lengthTypeAndValueMatch(currentImage.imageSlices(), Percent, 100))
+ if (currentImage.fill() == false && lengthMatchesAllSides(currentImage.imageSlices(), Length(100, Percent)))
return;
{% elif modifier_type == 'Width' and is_mask_box %}
// Masks have a different initial value for widths. Preserve the value of 'auto' for backwards compatibility.
- if (lengthTypeAndValueMatch(currentImage.borderSlices(), Auto, 0))
+ if (borderImageLengthMatchesAllSides(currentImage.borderSlices(), BorderImageLength(Length(Auto))))
return;
{% elif modifier_type == 'Width' and not is_mask_box %}
- if (lengthTypeAndValueMatch(currentImage.borderSlices(), Fixed, 1))
+ if (borderImageLengthMatchesAllSides(currentImage.borderSlices(), BorderImageLength(1.0)))
return;
{% endif %}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698