diff options
author | cavalcantii <cavalcantii@chromium.org> | 2016-03-19 18:02:03 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-20 01:03:15 +0000 |
commit | db8a8b23bfce3adeb9566da47cd724899d8d5b32 (patch) | |
tree | deb86d67ea5fc7e79acd6823ec06eb5de4c569ca | |
parent | 93f505fb7bdf5542ce40f8c14c987e7f31a97002 (diff) | |
download | chromium_src-db8a8b23bfce3adeb9566da47cd724899d8d5b32.zip chromium_src-db8a8b23bfce3adeb9566da47cd724899d8d5b32.tar.gz chromium_src-db8a8b23bfce3adeb9566da47cd724899d8d5b32.tar.bz2 |
CSS border-image spec compliance
Enforce compliance to css-background spec, where an element
will only have its border displayed if a border-style
is defined (even when border-image property is set).
Intent to deprecate and remove:
https://goo.gl/SVS8kd
BUG=559258
Review URL: https://codereview.chromium.org/1815043003
Cr-Commit-Position: refs/heads/master@{#382207}
9 files changed, 84 insertions, 18 deletions
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations index 8376c82..324a032 100644 --- a/third_party/WebKit/LayoutTests/TestExpectations +++ b/third_party/WebKit/LayoutTests/TestExpectations @@ -1396,6 +1396,4 @@ crbug.com/592185 fast/repaint/fixed-right-in-page-scale.html [ Failure Pass ] crbug.com/592409 inspector-protocol/debugger/stepping-with-blackboxed-ranges.html [ NeedsManualRebaseline ] -crbug.com/559258 [ Mac10.10 ] scrollbars/listbox-scrollbar-combinations.html [ Failure ] -crbug.com/559258 [ Mac10.10 ] virtual/rootlayerscrolls/scrollbars/listbox-scrollbar-combinations.html [ Failure ] crbug.com/594595 [ Linux ] http/tests/security/mixedContent/websocket/insecure-websocket-in-secure-page-worker-allowed.html [ Timeout Pass ] diff --git a/third_party/WebKit/LayoutTests/fast/borders/border-image-should-not-display-expected.html b/third_party/WebKit/LayoutTests/fast/borders/border-image-should-not-display-expected.html new file mode 100644 index 0000000..ed7f325 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/borders/border-image-should-not-display-expected.html @@ -0,0 +1,15 @@ +<!doctype html> +<html> +<head> +<style> +div { + background-color: green; + width: 100px; + height: 100px; +} +</style> +</head> +<body> +<div></div> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/borders/border-image-should-not-display.html b/third_party/WebKit/LayoutTests/fast/borders/border-image-should-not-display.html new file mode 100644 index 0000000..8894328c --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/borders/border-image-should-not-display.html @@ -0,0 +1,21 @@ +<!doctype html> +<html> +<head> +<style> +div { + background-color: green; + width: 100px; + height: 100px; + /* If border style is not set (default is None), border-image + should be ignored. + border-style: solid; + */ + border-image: url(resources/red.png) 30 round; + border-width: 100px; +} +</style> +</head> +<body> +<div></div> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/borders/red.png b/third_party/WebKit/LayoutTests/fast/borders/red.png Binary files differnew file mode 100644 index 0000000..490fa6a --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/borders/red.png diff --git a/third_party/WebKit/LayoutTests/fast/css/border-image-style-none-expected.txt b/third_party/WebKit/LayoutTests/fast/css/border-image-style-none-expected.txt index d6acece..c88bfef 100644 --- a/third_party/WebKit/LayoutTests/fast/css/border-image-style-none-expected.txt +++ b/third_party/WebKit/LayoutTests/fast/css/border-image-style-none-expected.txt @@ -1,9 +1,8 @@ -CONSOLE WARNING: Elements using the 'border-image' CSS property with no 'border-style' set should have no border, but currently do. Setting 'border-style' will be required in M51, around May 2016. See https://www.chromestatus.com/features/5542503914668032 for more details. PASS window.internals.isUseCounted(document, BorderImageWithBorderStyleNone) is false PASS window.internals.isUseCounted(document, BorderImageWithBorderStyleNone) is false PASS window.internals.isUseCounted(document, BorderImageWithBorderStyleNone) is false PASS window.internals.isUseCounted(document, BorderImageWithBorderStyleNone) is false -PASS window.internals.isUseCounted(document, BorderImageWithBorderStyleNone) is true +PASS window.internals.isUseCounted(document, BorderImageWithBorderStyleNone) is false PASS successfullyParsed is true TEST COMPLETE diff --git a/third_party/WebKit/LayoutTests/fast/css/border-image-style-none.html b/third_party/WebKit/LayoutTests/fast/css/border-image-style-none.html index 28c88b5..cfda5a8b 100644 --- a/third_party/WebKit/LayoutTests/fast/css/border-image-style-none.html +++ b/third_party/WebKit/LayoutTests/fast/css/border-image-style-none.html @@ -43,7 +43,7 @@ style.borderTopWidth = '10px'; runAfterLayoutAndPaint(function() { - shouldBeTrue("window.internals.isUseCounted(document, BorderImageWithBorderStyleNone)"); + shouldBeFalse("window.internals.isUseCounted(document, BorderImageWithBorderStyleNone)"); finishJSTest(); }); }); diff --git a/third_party/WebKit/LayoutTests/scrollbars/listbox-scrollbar-combinations.html b/third_party/WebKit/LayoutTests/scrollbars/listbox-scrollbar-combinations.html index e4c3514..49988b6 100644 --- a/third_party/WebKit/LayoutTests/scrollbars/listbox-scrollbar-combinations.html +++ b/third_party/WebKit/LayoutTests/scrollbars/listbox-scrollbar-combinations.html @@ -69,6 +69,7 @@ option[selected] { border-width: 0 2px; background-image: url(resources/horizontal-button-background.png); background-repeat: repeat-x; + border-style: solid; } ::-webkit-scrollbar:horizontal:corner-present { @@ -82,6 +83,7 @@ option[selected] { ::-webkit-scrollbar:horizontal:window-inactive { -webkit-border-image: url(resources/horizontal-button-inactive.png) 0 2 0 2; background-image: url(resources/horizontal-button-background-inactive.png); + border-style: solid; } ::-webkit-scrollbar-thumb:horizontal { @@ -89,18 +91,22 @@ option[selected] { border-color: transparent; border-width: 0 13px; min-width: 20px; + border-style: solid; } ::-webkit-scrollbar-thumb:horizontal:hover { -webkit-border-image: url(resources/horizontal-thumb-hover.png) 0 13 0 13; + border-style: solid; } ::-webkit-scrollbar-thumb:horizontal:active { -webkit-border-image: url(resources/horizontal-thumb-active.png) 0 13 0 13; + border-style: solid; } ::-webkit-scrollbar-thumb:horizontal:window-inactive { -webkit-border-image: url(resources/horizontal-thumb-inactive.png) 0 13 0 13; + border-style: solid; } ::-webkit-scrollbar-track-piece:horizontal:start:no-button, @@ -141,34 +147,41 @@ option[selected] { -webkit-border-image: url(resources/horizontal-track-disabled.png) 0 13 0 13; border-color: transparent; border-width: 0 13px; + border-style: solid; } ::-webkit-scrollbar-track-piece:horizontal:decrement { -webkit-border-image: url(resources/horizontal-track.png) 0 13 0 13; border-color: transparent; border-width: 0 0 0 13px; + border-style: solid; } ::-webkit-scrollbar-track-piece:horizontal:decrement:hover { -webkit-border-image: url(resources/horizontal-track-hover.png) 0 13 0 13; + border-style: solid; } ::-webkit-scrollbar-track-piece:horizontal:decrement:active { -webkit-border-image: url(resources/horizontal-track-active.png) 0 13 0 13; + border-style: solid; } ::-webkit-scrollbar-track-piece:horizontal:increment { -webkit-border-image: url(resources/horizontal-track.png) 0 13 0 13; border-color: transparent; border-width: 0 13px 0 0; + border-style: solid; } ::-webkit-scrollbar-track-piece:horizontal:increment:hover { -webkit-border-image: url(resources/horizontal-track-hover.png) 0 13 0 13; + border-style: solid; } ::-webkit-scrollbar-track-piece:horizontal:increment:active { -webkit-border-image: url(resources/horizontal-track-active.png) 0 13 0 13; + border-style: solid; } ::-webkit-scrollbar-button:horizontal { @@ -176,6 +189,7 @@ option[selected] { -webkit-border-image: url(resources/horizontal-button.png) 0 2 0 2; border-color: transparent; border-width: 0 2px; + border-style: solid; } ::-webkit-scrollbar-button:horizontal:decrement { @@ -187,16 +201,19 @@ option[selected] { ::-webkit-scrollbar-button:horizontal:decrement:hover { -webkit-border-image: url(resources/horizontal-button-hover.png) 0 2 0 2; background-image: url(resources/horizontal-decrement-arrow.png), url(resources/horizontal-button-background-hover.png); + border-style: solid; } ::-webkit-scrollbar-button:horizontal:decrement:active { -webkit-border-image: url(resources/horizontal-button-active.png) 0 2 0 2; background-image: url(resources/horizontal-decrement-arrow.png), url(resources/horizontal-button-background-active.png); + border-style: solid; } ::-webkit-scrollbar-button:horizontal:decrement:window-inactive { -webkit-border-image: url(resources/horizontal-button-inactive.png) 0 2 0 2; background-image: url(resources/horizontal-decrement-arrow.png), url(resources/horizontal-button-background-inactive.png); + border-style: solid; } ::-webkit-scrollbar-button:horizontal:increment { @@ -208,16 +225,19 @@ option[selected] { ::-webkit-scrollbar-button:horizontal:increment:hover { -webkit-border-image: url(resources/horizontal-button-hover.png) 0 2 0 2; background-image: url(resources/horizontal-increment-arrow.png), url(resources/horizontal-button-background-hover.png); + border-style: solid; } ::-webkit-scrollbar-button:horizontal:increment:active { -webkit-border-image: url(resources/horizontal-button-active.png) 0 2 0 2; background-image: url(resources/horizontal-increment-arrow.png), url(resources/horizontal-button-background-active.png); + border-style: solid; } ::-webkit-scrollbar-button:horizontal:increment:window-inactive { -webkit-border-image: url(resources/horizontal-button-inactive.png) 0 2 0 2; background-image: url(resources/horizontal-increment-arrow.png), url(resources/horizontal-button-background-inactive.png); + border-style: solid; } :not(.single)::-webkit-scrollbar-button:double-button:horizontal:start:decrement, @@ -267,6 +287,7 @@ option[selected] { border-width: 2px 0; background-image: url(resources/vertical-button-background.png); background-repeat: repeat-y; + border-style: solid; } ::-webkit-scrollbar:vertical:corner-present { @@ -280,6 +301,7 @@ option[selected] { ::-webkit-scrollbar:vertical:window-inactive { -webkit-border-image: url(resources/vertical-button-inactive.png) 2 0 2 0; background-image: url(resources/vertical-button-background-inactive.png); + border-style: solid; } ::-webkit-scrollbar-thumb:vertical { @@ -288,18 +310,22 @@ option[selected] { border-width: 13px 0; min-height: 20px; border-style: solid; + border-style: solid; } ::-webkit-scrollbar-thumb:vertical:hover { -webkit-border-image: url(resources/vertical-thumb-hover.png) 13 0 13 0; + border-style: solid; } ::-webkit-scrollbar-thumb:vertical:active { -webkit-border-image: url(resources/vertical-thumb-active.png) 13 0 13 0; + border-style: solid; } ::-webkit-scrollbar-thumb:vertical:window-inactive { -webkit-border-image: url(resources/vertical-thumb-inactive.png) 13 0 13 0; + border-style: solid; } ::-webkit-scrollbar-track-piece:vertical:start:no-button, @@ -347,28 +373,34 @@ option[selected] { -webkit-border-image: url(resources/vertical-track.png) 13 0 13 0; border-color: transparent; border-width: 13px 0 0 0; + border-style: solid; } ::-webkit-scrollbar-track-piece:vertical:decrement:hover { -webkit-border-image: url(resources/vertical-track-hover.png) 13 0 13 0; + border-style: solid; } ::-webkit-scrollbar-track-piece:vertical:decrement:active { -webkit-border-image: url(resources/vertical-track-active.png) 13 0 13 0; + border-style: solid; } ::-webkit-scrollbar-track-piece:vertical:increment { -webkit-border-image: url(resources/vertical-track.png) 13 0 13 0; border-color: transparent; border-width: 0 0 13px 0; + border-style: solid; } ::-webkit-scrollbar-track-piece:vertical:increment:hover { -webkit-border-image: url(resources/vertical-track-hover.png) 13 0 13 0; + border-style: solid; } ::-webkit-scrollbar-track-piece:vertical:increment:active { -webkit-border-image: url(resources/vertical-track-active.png) 13 0 13 0; + border-style: solid; } ::-webkit-scrollbar-button:vertical { @@ -376,6 +408,7 @@ option[selected] { -webkit-border-image: url(resources/vertical-button.png) 2 0 2 0; border-color: transparent; border-width: 2px 0; + border-style: solid; } ::-webkit-scrollbar-button:vertical:decrement { @@ -387,16 +420,19 @@ option[selected] { ::-webkit-scrollbar-button:vertical:decrement:hover { -webkit-border-image: url(resources/vertical-button-hover.png) 2 0 2 0; background-image: url(resources/vertical-decrement-arrow.png), url(resources/vertical-button-background-hover.png); + border-style: solid; } ::-webkit-scrollbar-button:vertical:decrement:active { -webkit-border-image: url(resources/vertical-button-active.png) 2 0 2 0; background-image: url(resources/vertical-decrement-arrow.png), url(resources/vertical-button-background-active.png); + border-style: solid; } ::-webkit-scrollbar-button:vertical:decrement:window-inactive { -webkit-border-image: url(resources/vertical-button-inactive.png) 2 0 2 0; background-image: url(resources/vertical-decrement-arrow.png), url(resources/vertical-button-background-inactive.png); + border-style: solid; } ::-webkit-scrollbar-button:vertical:increment { @@ -408,16 +444,19 @@ option[selected] { ::-webkit-scrollbar-button:vertical:increment:hover { -webkit-border-image: url(resources/vertical-button-hover.png) 2 0 2 0; background-image: url(resources/vertical-increment-arrow.png), url(resources/vertical-button-background-hover.png); + border-style: solid; } ::-webkit-scrollbar-button:vertical:increment:active { -webkit-border-image: url(resources/vertical-button-active.png) 2 0 2 0; background-image: url(resources/vertical-increment-arrow.png), url(resources/vertical-button-background-active.png); + border-style: solid; } ::-webkit-scrollbar-button:vertical:increment:window-inactive { -webkit-border-image: url(resources/vertical-button-inactive.png) 2 0 2 0; background-image: url(resources/vertical-increment-arrow.png), url(resources/vertical-button-background-inactive.png); + border-style: solid; } :not(.single)::-webkit-scrollbar-button:double-button:vertical:start:decrement, diff --git a/third_party/WebKit/Source/core/style/BorderData.h b/third_party/WebKit/Source/core/style/BorderData.h index 4a12c22..72d28e1 100644 --- a/third_party/WebKit/Source/core/style/BorderData.h +++ b/third_party/WebKit/Source/core/style/BorderData.h @@ -46,8 +46,7 @@ public: bool hasBorder() const { - bool haveImage = m_image.hasImage(); - return m_left.nonZero(!haveImage) || m_right.nonZero(!haveImage) || m_top.nonZero(!haveImage) || m_bottom.nonZero(!haveImage); + return m_left.nonZero() || m_right.nonZero() || m_top.nonZero() || m_bottom.nonZero(); } bool hasBorderFill() const @@ -70,28 +69,28 @@ public: int borderLeftWidth() const { - if (!m_image.hasImage() && (m_left.style() == BorderStyleNone || m_left.style() == BorderStyleHidden)) + if (m_left.style() == BorderStyleNone || m_left.style() == BorderStyleHidden) return 0; return m_left.width(); } int borderRightWidth() const { - if (!m_image.hasImage() && (m_right.style() == BorderStyleNone || m_right.style() == BorderStyleHidden)) + if (m_right.style() == BorderStyleNone || m_right.style() == BorderStyleHidden) return 0; return m_right.width(); } int borderTopWidth() const { - if (!m_image.hasImage() && (m_top.style() == BorderStyleNone || m_top.style() == BorderStyleHidden)) + if (m_top.style() == BorderStyleNone || m_top.style() == BorderStyleHidden) return 0; return m_top.width(); } int borderBottomWidth() const { - if (!m_image.hasImage() && (m_bottom.style() == BorderStyleNone || m_bottom.style() == BorderStyleHidden)) + if (m_bottom.style() == BorderStyleNone || m_bottom.style() == BorderStyleHidden) return 0; return m_bottom.width(); } diff --git a/third_party/WebKit/Source/core/style/BorderValue.h b/third_party/WebKit/Source/core/style/BorderValue.h index 7914be9..78ea456 100644 --- a/third_party/WebKit/Source/core/style/BorderValue.h +++ b/third_party/WebKit/Source/core/style/BorderValue.h @@ -45,9 +45,9 @@ public: { } - bool nonZero(bool checkStyle = true) const + bool nonZero() const { - return width() && (!checkStyle || m_style != BorderStyleNone); + return width() && (m_style != BorderStyleNone); } bool isTransparent() const @@ -55,11 +55,6 @@ public: return !m_colorIsCurrentColor && !m_color.alpha(); } - bool isVisible(bool checkStyle = true) const - { - return nonZero(checkStyle) && !isTransparent() && (!checkStyle || m_style != BorderStyleHidden); - } - bool operator==(const BorderValue& o) const { return m_width == o.m_width && m_style == o.m_style && m_color == o.m_color && m_colorIsCurrentColor == o.m_colorIsCurrentColor; |