Guest User

Untitled

a guest
Nov 23rd, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. // Copyright 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4.  
  5. // Generated from template:
  6. // core/css/properties/templates/CSSPropertySubclass.h.tmpl
  7. // and input files:
  8. // ../../third_party/WebKit/Source/core/css/ComputedStyleFieldAliases.json5
  9. // ../../third_party/WebKit/Source/core/css/CSSProperties.json5
  10. // ../../third_party/WebKit/Source/core/css/properties/CSSPropertyMethods.json5
  11.  
  12.  
  13. #ifndef GEN_BLINK_CORE_CSS_PROPERTIES_LONGHAND_BorderImageOutset_h
  14. #define GEN_BLINK_CORE_CSS_PROPERTIES_LONGHAND_BorderImageOutset_h
  15.  
  16. #include "core/css/properties/Longhand.h"
  17. #include "core/css/CSSIdentifierValue.h"
  18. #include "core/css/properties/StyleBuildingUtils.h"
  19. #include "core/css/resolver/StyleResolverState.h"
  20. #include "core/style/ComputedStyle.h"
  21.  
  22. namespace blink {
  23.  
  24. class CSSValue;
  25.  
  26. namespace CSSLonghand {
  27.  
  28. // Implements the 'border-image-outset' CSS property
  29. // See src/third_party/WebKit/Source/core/css/properties/README.md
  30. class BorderImageOutset : public Longhand {
  31. public:
  32. constexpr BorderImageOutset(CSSPropertyID id) : Longhand(id) {}
  33. const CSSValue* ParseSingleValue(CSSParserTokenRange&, const CSSParserContext&, const CSSParserLocalContext&) const override;
  34. bool IsInterpolable() const override { return true; }
  35.  
  36. // Style builder functions
  37. void ApplyInitial(StyleResolverState& state) const override {
  38. const NinePieceImage& currentImage = state.Style()->BorderImage();
  39. if (StyleBuildingUtils::borderImageLengthMatchesAllSides(currentImage.Outset(),
  40. BorderImageLength(Length(0, kFixed))))
  41. return;
  42. NinePieceImage image(currentImage);
  43. image.SetOutset(Length(0, kFixed));
  44. state.Style()->SetBorderImage(image);
  45. }
  46. void ApplyInherit(StyleResolverState& state) const override {
  47. NinePieceImage image(state.Style()->BorderImage());
  48. image.CopyOutsetFrom(state.ParentStyle()->BorderImage());
  49. state.Style()->SetBorderImage(image);
  50. }
  51. void ApplyValue(StyleResolverState& state, const CSSValue& value) const override {
  52. NinePieceImage image(state.Style()->BorderImage());
  53. image.SetOutset(CSSToStyleMap::MapNinePieceImageQuad(state, value));
  54. state.Style()->SetBorderImage(image);
  55. }
  56. };
  57.  
  58. } // namespace CSSLonghand
  59. } // namespace blink
  60.  
  61. #endif // GEN_BLINK_CORE_CSS_PROPERTIES_LONGHAND_BorderImageOutset_h
Add Comment
Please, Sign In to add comment