summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit
diff options
context:
space:
mode:
authorhyatt@apple.com <hyatt@apple.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538>2011-09-01 16:01:33 +0000
committerhyatt@apple.com <hyatt@apple.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538>2011-09-01 16:01:33 +0000
commit807190863f196a7894935a5fd15211e61caafc41 (patch)
tree361f4af5105a1da96c97e4679c3805fbfb6d28d3 /third_party/WebKit
parent87b1cb60c642b9f8f7a4d15f26b2cfdcd874ff97 (diff)
downloadchromium_src-807190863f196a7894935a5fd15211e61caafc41.zip
chromium_src-807190863f196a7894935a5fd15211e61caafc41.tar.gz
chromium_src-807190863f196a7894935a5fd15211e61caafc41.tar.bz2
Source/WebCore: https://bugs.webkit.org/show_bug.cgi?id=67321
Implement border-image-slice. This will eventually be a component of the new border-image shorthand property. It holds the cuts that you make into the border image along with a new optional "fill" keyword that indicates whether or not the center should be filled with the middle slice of the image. By default -webkit-border-image has always filled, but this does not match the specification. To preserve backwards compatibility, -webkit-border-image will continue to fill by default, but this does slightly affect computed style results, since the "fill" keyword will now be included in property dumps. Reviewed by Beth Dakin. Added fast/borders/border-image-slices.html. * CMakeLists.txt: * WebCore.gypi: * WebCore.pro: * WebCore.vcproj/WebCore.vcproj: * WebCore.xcodeproj/project.pbxproj: * css/CSSBorderImageSliceValue.cpp: Added. (WebCore::CSSBorderImageSliceValue::CSSBorderImageSliceValue): (WebCore::CSSBorderImageSliceValue::~CSSBorderImageSliceValue): (WebCore::CSSBorderImageSliceValue::cssText): * css/CSSBorderImageSliceValue.h: Added. (WebCore::CSSBorderImageSliceValue::create): (WebCore::CSSBorderImageSliceValue::isBorderImageSliceValue): Add a new CSSBorderImageSliceValue that holds both the four slices (as a CSS rect) and the fill keyword (as a boolean). Note that the cssText() dumping of the slices has been refined to be smarter, and it will no longer dump repeating values. * css/CSSBorderImageValue.cpp: (WebCore::CSSBorderImageValue::CSSBorderImageValue): (WebCore::CSSBorderImageValue::cssText): * css/CSSBorderImageValue.h: (WebCore::CSSBorderImageValue::create): CSSBorderImageValue now owns a CSSBorderImageSliceValue instead of just a CSS rect. * css/CSSComputedStyleDeclaration.cpp: (WebCore::valueForNinePieceImageSlice): (WebCore::valueForNinePieceImage): Add a new method, valueForNinePieceImageSlice, for getting the slices plus the fill value from the NinePieceImage and putting it into a CSSBorderImageSliceValue. This method is now used by valueForNinePieceImage to get the CSSBorderImageSliceValue that is part of the overall CSSBorderImageValue. (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Adding support for the new properties: border-image-slice and -webkit-mask-box-image-slice. * css/CSSParser.cpp: (WebCore::CSSParser::parseValue): (WebCore::BorderImageParseContext::BorderImageParseContext): (WebCore::BorderImageParseContext::allowBreak): (WebCore::BorderImageParseContext::commitImage): (WebCore::BorderImageParseContext::commitSlice): (WebCore::BorderImageParseContext::commitSlash): (WebCore::BorderImageParseContext::commitBorderImage): (WebCore::CSSParser::parseBorderImage): Modify parseBorderImage to no longer parse the slices itself. Instead it farms out the parsing to parseBorderImageSlice. (WebCore::BorderImageSliceParseContext::BorderImageSliceParseContext): (WebCore::BorderImageSliceParseContext::allowNumber): (WebCore::BorderImageSliceParseContext::allowFill): (WebCore::BorderImageSliceParseContext::allowFinalCommit): (WebCore::BorderImageSliceParseContext::top): (WebCore::BorderImageSliceParseContext::commitNumber): (WebCore::BorderImageSliceParseContext::commitFill): (WebCore::BorderImageSliceParseContext::setAllowFinalCommit): (WebCore::BorderImageSliceParseContext::setTop): (WebCore::BorderImageSliceParseContext::commitBorderImageSlice): (WebCore::CSSParser::parseBorderImageSlice): Slice parsing has now been broken out so that it can be parsed as a single property. In addition support for the "fill" keyword has been added to control image filling. * css/CSSParser.h: Modified to add the new parseBorderImageSlice method. * css/CSSPropertyNames.in: Add the new properties: border-image-slice and -webkit-mask-box-image-slice. * css/CSSStyleSelector.cpp: (WebCore::CSSStyleSelector::applyProperty): (WebCore::CSSStyleSelector::mapNinePieceImage): Rework mapNinePieceImage to call mapNinePieceImageSlice so that the mapping can be done just for the slices. (WebCore::CSSStyleSelector::mapNinePieceImageSlice): A new method that handles mapping just the slices into the front-end NinePieceImage. (WebCore::CSSStyleSelector::loadPendingImages): Modified to ensure the fill value is preserved when box-reflect makes a new NinePieceImage. * css/CSSStyleSelector.h: Added the new mapNinePieceImageSlice method. * css/CSSValue.h: (WebCore::CSSValue::isBorderImageSliceValue): Virtual function for identifying border image slice values. * rendering/RenderBoxModelObject.cpp: (WebCore::RenderBoxModelObject::paintNinePieceImage): The painting of the nine piece image has been modified to match the specification. The "fill" keyword controls whether or not the middle is painted. * rendering/style/NinePieceImage.cpp: (WebCore::NinePieceImage::operator==): The fill keyword has to be checked now for equality. * rendering/style/NinePieceImage.h: (WebCore::NinePieceImage::NinePieceImage): (WebCore::NinePieceImage::fill): (WebCore::NinePieceImage::setFill): Added the fill keyword to the front end NinePieceImage. (WebCore::NinePieceImage::copySlicesFrom): Added a helper to copy only the slices over from another NinePieceImage. Used when inheriting the border-image-slice property from a parent style. LayoutTests: Implement border-image-slice. This will eventually be a component of the new border-image shorthand property. It holds the cuts that you make into the border image along with a new optional "fill" keyword that indicates whether or not the center should be filled with the middle slice of the image. By default -webkit-border-image has always filled, but this does not match the specification. To preserve backwards compatibility, -webkit-border-image will continue to fill by default, but this does slightly affect computed style results, since the "fill" keyword will now be included in property dumps. Reviewed by Beth Dakin. Added fast/borders/border-image-slices.html. * fast/borders/border-image-slices.html: Added. * fast/css/getComputedStyle/computed-style-expected.txt: * fast/css/getComputedStyle/computed-style-with-zoom-expected.txt: * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: * fast/css/getComputedStyle/getComputedStyle-border-image-expected.txt: * fast/css/uri-token-parsing-expected.txt: * fast/css/uri-token-parsing.html: * platform/mac/fast/borders/border-image-slices-expected.png: Added. * platform/mac/fast/borders/border-image-slices-expected.txt: Added. * svg/css/getComputedStyle-basic-expected.txt: git-svn-id: svn://svn.chromium.org/blink/trunk@94299 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit')
-rw-r--r--third_party/WebKit/LayoutTests/ChangeLog25
-rw-r--r--third_party/WebKit/LayoutTests/fast/borders/border-image-slices.html39
-rw-r--r--third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt2
-rw-r--r--third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-with-zoom-expected.txt2
-rw-r--r--third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt2
-rw-r--r--third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-image-expected.txt4
-rw-r--r--third_party/WebKit/LayoutTests/fast/css/uri-token-parsing-expected.txt8
-rw-r--r--third_party/WebKit/LayoutTests/fast/css/uri-token-parsing.html8
-rw-r--r--third_party/WebKit/LayoutTests/fast/reflections/reflection-computed-style-expected.txt2
-rw-r--r--third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-image-slices-expected.txt17
-rw-r--r--third_party/WebKit/LayoutTests/svg/css/getComputedStyle-basic-expected.txt8
-rw-r--r--third_party/WebKit/Source/WebCore/CMakeLists.txt1
-rw-r--r--third_party/WebKit/Source/WebCore/ChangeLog120
-rw-r--r--third_party/WebKit/Source/WebCore/WebCore.gypi2
-rw-r--r--third_party/WebKit/Source/WebCore/WebCore.pro1
-rwxr-xr-xthird_party/WebKit/Source/WebCore/WebCore.vcproj/WebCore.vcproj8
-rw-r--r--third_party/WebKit/Source/WebCore/WebCore.xcodeproj/project.pbxproj8
-rw-r--r--third_party/WebKit/Source/WebCore/css/CSSBorderImageSliceValue.cpp67
-rw-r--r--third_party/WebKit/Source/WebCore/css/CSSBorderImageSliceValue.h59
-rw-r--r--third_party/WebKit/Source/WebCore/css/CSSBorderImageValue.cpp14
-rw-r--r--third_party/WebKit/Source/WebCore/css/CSSBorderImageValue.h10
-rw-r--r--third_party/WebKit/Source/WebCore/css/CSSComputedStyleDeclaration.cpp36
-rw-r--r--third_party/WebKit/Source/WebCore/css/CSSParser.cpp196
-rw-r--r--third_party/WebKit/Source/WebCore/css/CSSParser.h670
-rw-r--r--third_party/WebKit/Source/WebCore/css/CSSPropertyNames.in2
-rw-r--r--third_party/WebKit/Source/WebCore/css/CSSStyleSelector.cpp74
-rw-r--r--third_party/WebKit/Source/WebCore/css/CSSStyleSelector.h3
-rw-r--r--third_party/WebKit/Source/WebCore/css/CSSValue.h1
-rw-r--r--third_party/WebKit/Source/WebCore/rendering/RenderBoxModelObject.cpp2
-rw-r--r--third_party/WebKit/Source/WebCore/rendering/style/NinePieceImage.cpp4
-rw-r--r--third_party/WebKit/Source/WebCore/rendering/style/NinePieceImage.h15
31 files changed, 957 insertions, 453 deletions
diff --git a/third_party/WebKit/LayoutTests/ChangeLog b/third_party/WebKit/LayoutTests/ChangeLog
index 78295390..1faea25 100644
--- a/third_party/WebKit/LayoutTests/ChangeLog
+++ b/third_party/WebKit/LayoutTests/ChangeLog
@@ -1,3 +1,28 @@
+2011-08-31 David Hyatt <hyatt@apple.com>
+
+ Implement border-image-slice. This will eventually be a component of the new border-image shorthand
+ property. It holds the cuts that you make into the border image along with a new optional "fill"
+ keyword that indicates whether or not the center should be filled with the middle slice of the image.
+
+ By default -webkit-border-image has always filled, but this does not match the specification. To preserve
+ backwards compatibility, -webkit-border-image will continue to fill by default, but this does slightly affect
+ computed style results, since the "fill" keyword will now be included in property dumps.
+
+ Reviewed by Beth Dakin.
+
+ Added fast/borders/border-image-slices.html.
+
+ * fast/borders/border-image-slices.html: Added.
+ * fast/css/getComputedStyle/computed-style-expected.txt:
+ * fast/css/getComputedStyle/computed-style-with-zoom-expected.txt:
+ * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt:
+ * fast/css/getComputedStyle/getComputedStyle-border-image-expected.txt:
+ * fast/css/uri-token-parsing-expected.txt:
+ * fast/css/uri-token-parsing.html:
+ * platform/mac/fast/borders/border-image-slices-expected.png: Added.
+ * platform/mac/fast/borders/border-image-slices-expected.txt: Added.
+ * svg/css/getComputedStyle-basic-expected.txt:
+
2011-09-01 Zsolt Fehér <feherzs@inf.u-szeged.hu>
Unreviewed Qt gardening.
diff --git a/third_party/WebKit/LayoutTests/fast/borders/border-image-slices.html b/third_party/WebKit/LayoutTests/fast/borders/border-image-slices.html
new file mode 100644
index 0000000..d0e1cf6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/borders/border-image-slices.html
@@ -0,0 +1,39 @@
+<html>
+<head>
+ <style>
+ div {
+ border-width: 21px 30px 30px 21px;
+ width: 75px;
+ height: 75px;
+ margin: 10px;
+ display: inline-block;
+ border-image-source: url("resources/border-image.png") !important;
+ border-image-slice: 21 30 30 21 fill !important;
+ }
+
+ div.rr {
+ -webkit-border-image: none 0 0 0 0 repeat repeat;
+ }
+
+ div.rs {
+ -webkit-border-image: none 0 0 0 0 repeat stretch;
+ }
+
+ div.sr {
+ -webkit-border-image: none 0 0 0 0 stretch repeat;
+ }
+
+ div.ss {
+ -webkit-border-image: none 0 0 0 0 stretch stretch;
+ border-image-slice: 21 30 30 21 !important; // Omit 'fill' to show a hollow center.
+ }
+ </style>
+</head>
+<body>
+ <div class="rr"></div>
+ <div class="rs"></div>
+ <br>
+ <div class="sr"></div>
+ <div class="ss"></div>
+</body>
+</html>
diff --git a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt b/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt
index 6ad6586..0a89873 100644
--- a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-expected.txt
@@ -14,6 +14,7 @@ border-bottom-right-radius: 0px;
border-bottom-style: none;
border-bottom-width: 0px;
border-collapse: separate;
+border-image-slice: 100%;
border-image-source: none;
border-left-color: rgb(0, 0, 0);
border-left-style: none;
@@ -155,6 +156,7 @@ zoom: 1;
-webkit-marquee-style: scroll;
-webkit-mask-attachment: scroll;
-webkit-mask-box-image: none;
+-webkit-mask-box-image-slice: 100%;
-webkit-mask-box-image-source: none;
-webkit-mask-clip: border-box;
-webkit-mask-composite: source-over;
diff --git a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-with-zoom-expected.txt b/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-with-zoom-expected.txt
index 31b8b59..eb932e7 100644
--- a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-with-zoom-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-with-zoom-expected.txt
@@ -5,7 +5,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS -webkit-border-horizontal-spacing, value: "20px"
PASS -webkit-border-vertical-spacing, value: "20px"
-PASS -webkit-box-reflect, value: "below 20px -webkit-gradient(linear, 0% 0%, 0% 100%, from(transparent), to(white)) 0 0 0 0 stretch stretch"
+PASS -webkit-box-reflect, value: "below 20px -webkit-gradient(linear, 0% 0%, 0% 100%, from(transparent), to(white)) 0 fill stretch stretch"
PASS -webkit-box-shadow, value: "rgb(255, 0, 0) 20px 20px 20px 20px"
PASS -webkit-column-rule-width, value: "20px"
PASS -webkit-perspective-origin, value: "20px 20px"
diff --git a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt b/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
index 553afa1..283bdba 100644
--- a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/computed-style-without-renderer-expected.txt
@@ -13,6 +13,7 @@ Computed style of an element whose parent's 'display' value is 'none':
border-bottom-style: none
border-bottom-width: 0px
border-collapse: separate
+ border-image-slice: 100%
border-image-source: none
border-left-color: rgb(0, 0, 0)
border-left-style: none
@@ -154,6 +155,7 @@ Computed style of an element whose parent's 'display' value is 'none':
-webkit-marquee-style: scroll
-webkit-mask-attachment: scroll
-webkit-mask-box-image: none
+ -webkit-mask-box-image-slice: 100%
-webkit-mask-box-image-source: none
-webkit-mask-clip: border-box
-webkit-mask-composite: source-over
diff --git a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-image-expected.txt b/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-image-expected.txt
index 3f59b3c..4485d77 100644
--- a/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-image-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-border-image-expected.txt
@@ -7,11 +7,11 @@ Test calling getPropertyValue on computed styles for -webkit-border-image proper
-webkit-border-image: -webkit-gradient(linear, 0 0, 0 0) 25 25 25 25 stretch stretch;
-webkit-border-image
- getPropertyValue: -webkit-gradient(linear, 0 0, 0 0) 25 25 25 25 stretch stretch
+ getPropertyValue: -webkit-gradient(linear, 0 0, 0 0) 25 fill stretch stretch
getPropertyCSSValue: [object CSSValue]
-webkit-border-image: -webkit-gradient(linear, 0 0, 0 0) 50 repeat;
-webkit-border-image
- getPropertyValue: -webkit-gradient(linear, 0 0, 0 0) 50 50 50 50 repeat repeat
+ getPropertyValue: -webkit-gradient(linear, 0 0, 0 0) 50 fill repeat repeat
getPropertyCSSValue: [object CSSValue]
diff --git a/third_party/WebKit/LayoutTests/fast/css/uri-token-parsing-expected.txt b/third_party/WebKit/LayoutTests/fast/css/uri-token-parsing-expected.txt
index 99b2d28..25a1f43 100644
--- a/third_party/WebKit/LayoutTests/fast/css/uri-token-parsing-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/css/uri-token-parsing-expected.txt
@@ -22,8 +22,8 @@ Rules from the stylesheet:
#r { list-style-image: url('url(r)'); }
#s { background-image: url('url(s)'); }
#t { -webkit-mask-image: url('url(t)'); }
-#u { -webkit-border-image: url('url(u)') 1 2 3 4 stretch round; }
-#v { -webkit-mask-box-image: url('url(v)') 1 2 3 4 stretch round; }
+#u { -webkit-border-image: url('url(u)') 1 2 3 4 fill stretch round; }
+#v { -webkit-mask-box-image: url('url(v)') 1 2 3 4 fill stretch round; }
Expected result:
#a { content: url(c); }
@@ -44,6 +44,6 @@ Expected result:
#r { list-style-image: url('url(r)'); }
#s { background-image: url('url(s)'); }
#t { -webkit-mask-image: url('url(t)'); }
-#u { -webkit-border-image: url('url(u)') 1 2 3 4 stretch round; }
-#v { -webkit-mask-box-image: url('url(v)') 1 2 3 4 stretch round; }
+#u { -webkit-border-image: url('url(u)') 1 2 3 4 fill stretch round; }
+#v { -webkit-mask-box-image: url('url(v)') 1 2 3 4 fill stretch round; }
diff --git a/third_party/WebKit/LayoutTests/fast/css/uri-token-parsing.html b/third_party/WebKit/LayoutTests/fast/css/uri-token-parsing.html
index a4a032f..effb1c4 100644
--- a/third_party/WebKit/LayoutTests/fast/css/uri-token-parsing.html
+++ b/third_party/WebKit/LayoutTests/fast/css/uri-token-parsing.html
@@ -18,8 +18,8 @@
#r { list-style-image: url("url(r)"); }
#s { background-image: url("url(s)"); }
#t { -webkit-mask-image: url("url(t)"); }
-#u { -webkit-border-image: url("url(u)") 1 2 3 4 stretch round; }
-#v { -webkit-mask-box-image: url("url(v)") 1 2 3 4 stretch round; }
+#u { -webkit-border-image: url("url(u)") 1 2 3 4 fill stretch round; }
+#v { -webkit-mask-box-image: url("url(v)") 1 2 3 4 fill stretch round; }
</style>
<script>
@@ -92,8 +92,8 @@ function runTest()
#r { list-style-image: url('url(r)'); }
#s { background-image: url('url(s)'); }
#t { -webkit-mask-image: url('url(t)'); }
-#u { -webkit-border-image: url('url(u)') 1 2 3 4 stretch round; }
-#v { -webkit-mask-box-image: url('url(v)') 1 2 3 4 stretch round; }
+#u { -webkit-border-image: url('url(u)') 1 2 3 4 fill stretch round; }
+#v { -webkit-mask-box-image: url('url(v)') 1 2 3 4 fill stretch round; }
</pre>
<script>
diff --git a/third_party/WebKit/LayoutTests/fast/reflections/reflection-computed-style-expected.txt b/third_party/WebKit/LayoutTests/fast/reflections/reflection-computed-style-expected.txt
index 273ca29..c1a19e0 100644
--- a/third_party/WebKit/LayoutTests/fast/reflections/reflection-computed-style-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/reflections/reflection-computed-style-expected.txt
@@ -17,6 +17,6 @@ Test calling getPropertyValue on computed styles for -webkit-border-image proper
-webkit-box-reflect: below 5px -webkit-gradient(linear, 0 0, 0 0) 25 25 25 25 stretch stretch;
-webkit-box-reflect
- getPropertyValue: below 5px -webkit-gradient(linear, 0 0, 0 0) 25 25 25 25 stretch stretch
+ getPropertyValue: below 5px -webkit-gradient(linear, 0 0, 0 0) 25 fill stretch stretch
getPropertyCSSValue: [object CSSValue]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-image-slices-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-image-slices-expected.txt
new file mode 100644
index 0000000..37927aa
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/borders/border-image-slices-expected.txt
@@ -0,0 +1,17 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {DIV} at (10,10) size 126x126 [border: (21px none #000000) (30px none #000000) (21px none #000000)]
+ RenderText {#text} at (146,132) size 4x18
+ text run at (146,132) width 4: " "
+ RenderBlock {DIV} at (160,10) size 126x126 [border: (21px none #000000) (30px none #000000) (21px none #000000)]
+ RenderText {#text} at (296,132) size 4x18
+ text run at (296,132) width 4: " "
+ RenderBR {BR} at (0,0) size 0x0
+ RenderBlock {DIV} at (10,160) size 126x126 [border: (21px none #000000) (30px none #000000) (21px none #000000)]
+ RenderText {#text} at (146,282) size 4x18
+ text run at (146,282) width 4: " "
+ RenderBlock {DIV} at (160,160) size 126x126 [border: (21px none #000000) (30px none #000000) (21px none #000000)]
+ RenderText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/svg/css/getComputedStyle-basic-expected.txt b/third_party/WebKit/LayoutTests/svg/css/getComputedStyle-basic-expected.txt
index a5995e7..7461eb0 100644
--- a/third_party/WebKit/LayoutTests/svg/css/getComputedStyle-basic-expected.txt
+++ b/third_party/WebKit/LayoutTests/svg/css/getComputedStyle-basic-expected.txt
@@ -26,6 +26,8 @@ rect: style.getPropertyValue(border-bottom-width) : 0px
rect: style.getPropertyCSSValue(border-bottom-width) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(border-collapse) : separate
rect: style.getPropertyCSSValue(border-collapse) : [object CSSPrimitiveValue]
+rect: style.getPropertyValue(border-image-slice) : 100%
+rect: style.getPropertyCSSValue(border-image-slice) : [object CSSValue]
rect: style.getPropertyValue(border-image-source) : none
rect: style.getPropertyCSSValue(border-image-source) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(border-left-color) : rgb(0, 0, 0)
@@ -308,6 +310,8 @@ rect: style.getPropertyValue(-webkit-mask-attachment) : scroll
rect: style.getPropertyCSSValue(-webkit-mask-attachment) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(-webkit-mask-box-image) : none
rect: style.getPropertyCSSValue(-webkit-mask-box-image) : [object CSSPrimitiveValue]
+rect: style.getPropertyValue(-webkit-mask-box-image-slice) : 100%
+rect: style.getPropertyCSSValue(-webkit-mask-box-image-slice) : [object CSSValue]
rect: style.getPropertyValue(-webkit-mask-box-image-source) : none
rect: style.getPropertyCSSValue(-webkit-mask-box-image-source) : [object CSSPrimitiveValue]
rect: style.getPropertyValue(-webkit-mask-clip) : border-box
@@ -488,6 +492,8 @@ g: style.getPropertyValue(border-bottom-width) : 0px
g: style.getPropertyCSSValue(border-bottom-width) : [object CSSPrimitiveValue]
g: style.getPropertyValue(border-collapse) : separate
g: style.getPropertyCSSValue(border-collapse) : [object CSSPrimitiveValue]
+g: style.getPropertyValue(border-image-slice) : 100%
+g: style.getPropertyCSSValue(border-image-slice) : [object CSSValue]
g: style.getPropertyValue(border-image-source) : none
g: style.getPropertyCSSValue(border-image-source) : [object CSSPrimitiveValue]
g: style.getPropertyValue(border-left-color) : rgb(0, 0, 0)
@@ -770,6 +776,8 @@ g: style.getPropertyValue(-webkit-mask-attachment) : scroll
g: style.getPropertyCSSValue(-webkit-mask-attachment) : [object CSSPrimitiveValue]
g: style.getPropertyValue(-webkit-mask-box-image) : none
g: style.getPropertyCSSValue(-webkit-mask-box-image) : [object CSSPrimitiveValue]
+g: style.getPropertyValue(-webkit-mask-box-image-slice) : 100%
+g: style.getPropertyCSSValue(-webkit-mask-box-image-slice) : [object CSSValue]
g: style.getPropertyValue(-webkit-mask-box-image-source) : none
g: style.getPropertyCSSValue(-webkit-mask-box-image-source) : [object CSSPrimitiveValue]
g: style.getPropertyValue(-webkit-mask-clip) : border-box
diff --git a/third_party/WebKit/Source/WebCore/CMakeLists.txt b/third_party/WebKit/Source/WebCore/CMakeLists.txt
index ef7bfd8..ad2220a 100644
--- a/third_party/WebKit/Source/WebCore/CMakeLists.txt
+++ b/third_party/WebKit/Source/WebCore/CMakeLists.txt
@@ -413,6 +413,7 @@ SET(WebCore_SOURCES
bindings/generic/RuntimeEnabledFeatures.cpp
css/CSSBorderImageValue.cpp
+ css/CSSBorderImageSliceValue.cpp
css/CSSCanvasValue.cpp
css/CSSCharsetRule.cpp
css/CSSComputedStyleDeclaration.cpp
diff --git a/third_party/WebKit/Source/WebCore/ChangeLog b/third_party/WebKit/Source/WebCore/ChangeLog
index bfbfc54..e378089 100644
--- a/third_party/WebKit/Source/WebCore/ChangeLog
+++ b/third_party/WebKit/Source/WebCore/ChangeLog
@@ -1,3 +1,123 @@
+2011-08-31 David Hyatt <hyatt@apple.com>
+
+ https://bugs.webkit.org/show_bug.cgi?id=67321
+
+ Implement border-image-slice. This will eventually be a component of the new border-image shorthand
+ property. It holds the cuts that you make into the border image along with a new optional "fill"
+ keyword that indicates whether or not the center should be filled with the middle slice of the image.
+
+ By default -webkit-border-image has always filled, but this does not match the specification. To preserve
+ backwards compatibility, -webkit-border-image will continue to fill by default, but this does slightly affect
+ computed style results, since the "fill" keyword will now be included in property dumps.
+
+ Reviewed by Beth Dakin.
+
+ Added fast/borders/border-image-slices.html.
+
+ * CMakeLists.txt:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * css/CSSBorderImageSliceValue.cpp: Added.
+ (WebCore::CSSBorderImageSliceValue::CSSBorderImageSliceValue):
+ (WebCore::CSSBorderImageSliceValue::~CSSBorderImageSliceValue):
+ (WebCore::CSSBorderImageSliceValue::cssText):
+ * css/CSSBorderImageSliceValue.h: Added.
+ (WebCore::CSSBorderImageSliceValue::create):
+ (WebCore::CSSBorderImageSliceValue::isBorderImageSliceValue):
+ Add a new CSSBorderImageSliceValue that holds both the four slices (as a CSS rect) and the
+ fill keyword (as a boolean). Note that the cssText() dumping of the slices has been refined
+ to be smarter, and it will no longer dump repeating values.
+
+ * css/CSSBorderImageValue.cpp:
+ (WebCore::CSSBorderImageValue::CSSBorderImageValue):
+ (WebCore::CSSBorderImageValue::cssText):
+ * css/CSSBorderImageValue.h:
+ (WebCore::CSSBorderImageValue::create):
+ CSSBorderImageValue now owns a CSSBorderImageSliceValue instead of just a CSS rect.
+
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::valueForNinePieceImageSlice):
+ (WebCore::valueForNinePieceImage):
+ Add a new method, valueForNinePieceImageSlice, for getting the slices plus the fill value
+ from the NinePieceImage and putting it into a CSSBorderImageSliceValue. This method is now used by
+ valueForNinePieceImage to get the CSSBorderImageSliceValue that is part of the overall
+ CSSBorderImageValue.
+
+ (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue):
+ Adding support for the new properties: border-image-slice and -webkit-mask-box-image-slice.
+
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseValue):
+ (WebCore::BorderImageParseContext::BorderImageParseContext):
+ (WebCore::BorderImageParseContext::allowBreak):
+ (WebCore::BorderImageParseContext::commitImage):
+ (WebCore::BorderImageParseContext::commitSlice):
+ (WebCore::BorderImageParseContext::commitSlash):
+ (WebCore::BorderImageParseContext::commitBorderImage):
+ (WebCore::CSSParser::parseBorderImage):
+ Modify parseBorderImage to no longer parse the slices itself. Instead it farms out the parsing
+ to parseBorderImageSlice.
+
+ (WebCore::BorderImageSliceParseContext::BorderImageSliceParseContext):
+ (WebCore::BorderImageSliceParseContext::allowNumber):
+ (WebCore::BorderImageSliceParseContext::allowFill):
+ (WebCore::BorderImageSliceParseContext::allowFinalCommit):
+ (WebCore::BorderImageSliceParseContext::top):
+ (WebCore::BorderImageSliceParseContext::commitNumber):
+ (WebCore::BorderImageSliceParseContext::commitFill):
+ (WebCore::BorderImageSliceParseContext::setAllowFinalCommit):
+ (WebCore::BorderImageSliceParseContext::setTop):
+ (WebCore::BorderImageSliceParseContext::commitBorderImageSlice):
+ (WebCore::CSSParser::parseBorderImageSlice):
+ Slice parsing has now been broken out so that it can be parsed as a single property. In addition
+ support for the "fill" keyword has been added to control image filling.
+
+ * css/CSSParser.h:
+ Modified to add the new parseBorderImageSlice method.
+
+ * css/CSSPropertyNames.in:
+ Add the new properties: border-image-slice and -webkit-mask-box-image-slice.
+
+ * css/CSSStyleSelector.cpp:
+ (WebCore::CSSStyleSelector::applyProperty):
+ (WebCore::CSSStyleSelector::mapNinePieceImage):
+ Rework mapNinePieceImage to call mapNinePieceImageSlice so that the mapping can be done just for
+ the slices.
+
+ (WebCore::CSSStyleSelector::mapNinePieceImageSlice):
+ A new method that handles mapping just the slices into the front-end NinePieceImage.
+
+ (WebCore::CSSStyleSelector::loadPendingImages):
+ Modified to ensure the fill value is preserved when box-reflect makes a new NinePieceImage.
+
+ * css/CSSStyleSelector.h:
+ Added the new mapNinePieceImageSlice method.
+
+ * css/CSSValue.h:
+ (WebCore::CSSValue::isBorderImageSliceValue):
+ Virtual function for identifying border image slice values.
+
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::paintNinePieceImage):
+ The painting of the nine piece image has been modified to match the specification. The "fill"
+ keyword controls whether or not the middle is painted.
+
+ * rendering/style/NinePieceImage.cpp:
+ (WebCore::NinePieceImage::operator==):
+ The fill keyword has to be checked now for equality.
+
+ * rendering/style/NinePieceImage.h:
+ (WebCore::NinePieceImage::NinePieceImage):
+ (WebCore::NinePieceImage::fill):
+ (WebCore::NinePieceImage::setFill):
+ Added the fill keyword to the front end NinePieceImage.
+
+ (WebCore::NinePieceImage::copySlicesFrom):
+ Added a helper to copy only the slices over from another NinePieceImage. Used when inheriting
+ the border-image-slice property from a parent style.
+
2011-09-01 Vsevolod Vlasov <vsevik@chromium.org>
Web Inspector: Decode query/form parameters names as well as values.
diff --git a/third_party/WebKit/Source/WebCore/WebCore.gypi b/third_party/WebKit/Source/WebCore/WebCore.gypi
index 3608a63..b526840 100644
--- a/third_party/WebKit/Source/WebCore/WebCore.gypi
+++ b/third_party/WebKit/Source/WebCore/WebCore.gypi
@@ -2306,6 +2306,8 @@
'config.h',
'css/CSSBorderImageValue.cpp',
'css/CSSBorderImageValue.h',
+ 'css/CSSBorderImageSliceValue.cpp',
+ 'css/CSSBorderImageSliceValue.h',
'css/CSSCanvasValue.cpp',
'css/CSSCanvasValue.h',
'css/CSSCharsetRule.cpp',
diff --git a/third_party/WebKit/Source/WebCore/WebCore.pro b/third_party/WebKit/Source/WebCore/WebCore.pro
index 0f33502..9f9ec86 100644
--- a/third_party/WebKit/Source/WebCore/WebCore.pro
+++ b/third_party/WebKit/Source/WebCore/WebCore.pro
@@ -386,6 +386,7 @@ v8 {
SOURCES += \
css/CSSBorderImageValue.cpp \
+ css/CSSBorderImageValue.h \
css/CSSCanvasValue.cpp \
css/CSSCharsetRule.cpp \
css/CSSComputedStyleDeclaration.cpp \
diff --git a/third_party/WebKit/Source/WebCore/WebCore.vcproj/WebCore.vcproj b/third_party/WebKit/Source/WebCore/WebCore.vcproj/WebCore.vcproj
index 6204319..b6873b1c 100755
--- a/third_party/WebKit/Source/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/third_party/WebKit/Source/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -32749,6 +32749,14 @@
RelativePath="..\css\CSSBorderImageValue.h"
>
</File>
+ <File
+ RelativePath="..\css\CSSBorderImageSliceValue.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\css\CSSBorderImageSliceValue.h"
+ >
+ </File>
<File
RelativePath="..\css\CSSCanvasValue.cpp"
>
diff --git a/third_party/WebKit/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/third_party/WebKit/Source/WebCore/WebCore.xcodeproj/project.pbxproj
index 1b608a7..6294aa7 100644
--- a/third_party/WebKit/Source/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/third_party/WebKit/Source/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -4919,6 +4919,8 @@
BC23F0DB0DAFF4A4009FDC91 /* GeneratedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = BC23F0DA0DAFF4A4009FDC91 /* GeneratedImage.h */; };
BC2441C40E8B65D00055320F /* ScrollView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2441C30E8B65D00055320F /* ScrollView.cpp */; };
BC25B52A131C6D3900180E10 /* LocalizedStringsMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC25B528131C6D3900180E10 /* LocalizedStringsMac.mm */; };
+ BC274B2F140EBEB200EADFA6 /* CSSBorderImageSliceValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC274B2E140EBEB200EADFA6 /* CSSBorderImageSliceValue.h */; };
+ BC274B31140EBED800EADFA6 /* CSSBorderImageSliceValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC274B30140EBED800EADFA6 /* CSSBorderImageSliceValue.cpp */; };
BC275B7911C5D1C300C9206C /* JSWebKitPointCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC275B7811C5D1C300C9206C /* JSWebKitPointCustom.cpp */; };
BC275B7D11C5D23500C9206C /* JSWebKitCSSMatrixCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC275B7C11C5D23500C9206C /* JSWebKitCSSMatrixCustom.cpp */; };
BC275B8111C5D2B400C9206C /* JSEventSourceCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC275B8011C5D2B400C9206C /* JSEventSourceCustom.cpp */; };
@@ -11633,6 +11635,8 @@
BC23F0DA0DAFF4A4009FDC91 /* GeneratedImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeneratedImage.h; sourceTree = "<group>"; };
BC2441C30E8B65D00055320F /* ScrollView.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollView.cpp; sourceTree = "<group>"; };
BC25B528131C6D3900180E10 /* LocalizedStringsMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalizedStringsMac.mm; sourceTree = "<group>"; };
+ BC274B2E140EBEB200EADFA6 /* CSSBorderImageSliceValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSBorderImageSliceValue.h; sourceTree = "<group>"; };
+ BC274B30140EBED800EADFA6 /* CSSBorderImageSliceValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSBorderImageSliceValue.cpp; sourceTree = "<group>"; };
BC275B7811C5D1C300C9206C /* JSWebKitPointCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitPointCustom.cpp; sourceTree = "<group>"; };
BC275B7C11C5D23500C9206C /* JSWebKitCSSMatrixCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebKitCSSMatrixCustom.cpp; sourceTree = "<group>"; };
BC275B8011C5D2B400C9206C /* JSEventSourceCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEventSourceCustom.cpp; sourceTree = "<group>"; };
@@ -19391,6 +19395,8 @@
930705C709E0C95F00B17FE4 /* Counter.idl */,
A80E6CBB0A1989CA007FB8C5 /* CSSBorderImageValue.cpp */,
A80E6CDD0A1989CA007FB8C5 /* CSSBorderImageValue.h */,
+ BC274B30140EBED800EADFA6 /* CSSBorderImageSliceValue.cpp */,
+ BC274B2E140EBEB200EADFA6 /* CSSBorderImageSliceValue.h */,
BC604A420DB5634E00204739 /* CSSCanvasValue.cpp */,
BC6049CB0DB560C200204739 /* CSSCanvasValue.h */,
E1EBBBD30AAC9B87001FE8E2 /* CSSCharsetRule.cpp */,
@@ -23464,6 +23470,7 @@
B10B6980140C174000BC1C26 /* WebVTTToken.h in Headers */,
B10B6982140C174000BC1C26 /* WebVTTTokenizer.h in Headers */,
9B0FB192140DB5790022588F /* HTTPValidation.h in Headers */,
+ BC274B2F140EBEB200EADFA6 /* CSSBorderImageSliceValue.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -26276,6 +26283,7 @@
E45322AB140CE267005A0F92 /* SelectorQuery.cpp in Sources */,
B10B6981140C174000BC1C26 /* WebVTTTokenizer.cpp in Sources */,
9B0FB191140DB5790022588F /* HTTPValidation.cpp in Sources */,
+ BC274B31140EBED800EADFA6 /* CSSBorderImageSliceValue.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/third_party/WebKit/Source/WebCore/css/CSSBorderImageSliceValue.cpp b/third_party/WebKit/Source/WebCore/css/CSSBorderImageSliceValue.cpp
new file mode 100644
index 0000000..2c6f632
--- /dev/null
+++ b/third_party/WebKit/Source/WebCore/css/CSSBorderImageSliceValue.cpp
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CSSBorderImageSliceValue.h"
+
+#include "PlatformString.h"
+#include "Rect.h"
+
+namespace WebCore {
+
+CSSBorderImageSliceValue::CSSBorderImageSliceValue(PassRefPtr<Rect> sliceRect, bool fill)
+ : m_rect(sliceRect)
+ , m_fill(fill)
+{
+}
+
+CSSBorderImageSliceValue::~CSSBorderImageSliceValue()
+{
+}
+
+String CSSBorderImageSliceValue::cssText() const
+{
+ // This isn't really a CSS rect, so we dump manually
+ String text = m_rect->top()->cssText();
+ if (m_rect->right() != m_rect->top() || m_rect->bottom() != m_rect->top() || m_rect->left() != m_rect->top()) {
+ text += " ";
+ text += m_rect->right()->cssText();
+ if (m_rect->bottom() != m_rect->top() || m_rect->right() != m_rect->left()) {
+ text += " ";
+ text += m_rect->bottom()->cssText();
+ if (m_rect->left() != m_rect->right()) {
+ text += " ";
+ text += m_rect->left()->cssText();
+ }
+ }
+ }
+
+ // Now the fill keywords if it is present.
+ if (m_fill)
+ text += " fill";
+ return text;
+}
+
+} // namespace WebCore
diff --git a/third_party/WebKit/Source/WebCore/css/CSSBorderImageSliceValue.h b/third_party/WebKit/Source/WebCore/css/CSSBorderImageSliceValue.h
new file mode 100644
index 0000000..9449be2
--- /dev/null
+++ b/third_party/WebKit/Source/WebCore/css/CSSBorderImageSliceValue.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CSSBorderImageSliceValue_h
+#define CSSBorderImageSliceValue_h
+
+#include "CSSValue.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class Rect;
+
+class CSSBorderImageSliceValue : public CSSValue {
+public:
+ static PassRefPtr<CSSBorderImageSliceValue> create(PassRefPtr<Rect> sliceRect, bool fill)
+ {
+ return adoptRef(new CSSBorderImageSliceValue(sliceRect, fill));
+ }
+ virtual ~CSSBorderImageSliceValue();
+
+ virtual String cssText() const;
+
+ // These four values are used to make "cuts" in the border image. They can be numbers
+ // or percentages.
+ RefPtr<Rect> m_rect;
+ bool m_fill;
+
+private:
+ CSSBorderImageSliceValue(PassRefPtr<Rect> sliceRect, bool fill);
+ virtual bool isBorderImageSliceValue() const { return true; }
+};
+
+} // namespace WebCore
+
+#endif // CSSBorderImageSliceValue_h
diff --git a/third_party/WebKit/Source/WebCore/css/CSSBorderImageValue.cpp b/third_party/WebKit/Source/WebCore/css/CSSBorderImageValue.cpp
index 8d4721a..273ef0e 100644
--- a/third_party/WebKit/Source/WebCore/css/CSSBorderImageValue.cpp
+++ b/third_party/WebKit/Source/WebCore/css/CSSBorderImageValue.cpp
@@ -26,9 +26,9 @@
namespace WebCore {
-CSSBorderImageValue::CSSBorderImageValue(PassRefPtr<CSSValue> image, PassRefPtr<Rect> imageRect, int horizontalRule, int verticalRule)
+CSSBorderImageValue::CSSBorderImageValue(PassRefPtr<CSSValue> image, PassRefPtr<CSSBorderImageSliceValue> slice, int horizontalRule, int verticalRule)
: m_image(image)
- , m_imageSliceRect(imageRect)
+ , m_slice(slice)
, m_horizontalSizeRule(horizontalRule)
, m_verticalSizeRule(verticalRule)
{
@@ -44,14 +44,8 @@ String CSSBorderImageValue::cssText() const
String text(m_image->cssText());
text += " ";
- // Now the rect, but it isn't really a rect, so we dump manually
- text += m_imageSliceRect->top()->cssText();
- text += " ";
- text += m_imageSliceRect->right()->cssText();
- text += " ";
- text += m_imageSliceRect->bottom()->cssText();
- text += " ";
- text += m_imageSliceRect->left()->cssText();
+ // Now the slices.
+ text += m_slice->cssText();
// Now the keywords.
text += " ";
diff --git a/third_party/WebKit/Source/WebCore/css/CSSBorderImageValue.h b/third_party/WebKit/Source/WebCore/css/CSSBorderImageValue.h
index 6e1b964..b2add12 100644
--- a/third_party/WebKit/Source/WebCore/css/CSSBorderImageValue.h
+++ b/third_party/WebKit/Source/WebCore/css/CSSBorderImageValue.h
@@ -21,7 +21,7 @@
#ifndef CSSBorderImageValue_h
#define CSSBorderImageValue_h
-#include "CSSValue.h"
+#include "CSSBorderImageSliceValue.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
@@ -31,9 +31,9 @@ class Rect;
class CSSBorderImageValue : public CSSValue {
public:
- static PassRefPtr<CSSBorderImageValue> create(PassRefPtr<CSSValue> image, PassRefPtr<Rect> sliceRect, int horizontalRule, int verticalRule)
+ static PassRefPtr<CSSBorderImageValue> create(PassRefPtr<CSSValue> image, PassRefPtr<CSSBorderImageSliceValue> slice, int horizontalRule, int verticalRule)
{
- return adoptRef(new CSSBorderImageValue(image, sliceRect, horizontalRule, verticalRule));
+ return adoptRef(new CSSBorderImageValue(image, slice, horizontalRule, verticalRule));
}
virtual ~CSSBorderImageValue();
@@ -48,14 +48,14 @@ public:
// These four values are used to make "cuts" in the image. They can be numbers
// or percentages.
- RefPtr<Rect> m_imageSliceRect;
+ RefPtr<CSSBorderImageSliceValue> m_slice;
// Values for how to handle the scaling/stretching/tiling of the image slices.
int m_horizontalSizeRule; // Rule for how to adjust the widths of the top/middle/bottom
int m_verticalSizeRule; // Rule for how to adjust the heights of the left/middle/right
private:
- CSSBorderImageValue(PassRefPtr<CSSValue> image, PassRefPtr<Rect> sliceRect, int horizontalRule, int verticalRule);
+ CSSBorderImageValue(PassRefPtr<CSSValue> image, PassRefPtr<CSSBorderImageSliceValue>, int horizontalRule, int verticalRule);
virtual bool isBorderImageValue() const { return true; }
};
diff --git a/third_party/WebKit/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/third_party/WebKit/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
index c6a956f..f167c0d 100644
--- a/third_party/WebKit/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
+++ b/third_party/WebKit/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
@@ -73,6 +73,7 @@ static const int computedProperties[] = {
CSSPropertyBorderBottomStyle,
CSSPropertyBorderBottomWidth,
CSSPropertyBorderCollapse,
+ CSSPropertyBorderImageSlice,
CSSPropertyBorderImageSource,
CSSPropertyBorderLeftColor,
CSSPropertyBorderLeftStyle,
@@ -224,6 +225,7 @@ static const int computedProperties[] = {
CSSPropertyWebkitMarqueeStyle,
CSSPropertyWebkitMaskAttachment,
CSSPropertyWebkitMaskBoxImage,
+ CSSPropertyWebkitMaskBoxImageSlice,
CSSPropertyWebkitMaskBoxImageSource,
CSSPropertyWebkitMaskClip,
CSSPropertyWebkitMaskComposite,
@@ -318,17 +320,10 @@ static int valueForRepeatRule(int rule)
return CSSValueStretch;
}
}
-
-static PassRefPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image, CSSPrimitiveValueCache* primitiveValueCache)
+
+
+static PassRefPtr<CSSBorderImageSliceValue> valueForNinePieceImageSlice(const NinePieceImage& image, CSSPrimitiveValueCache* primitiveValueCache)
{
- if (!image.hasImage())
- return primitiveValueCache->createIdentifierValue(CSSValueNone);
-
- // Image first.
- RefPtr<CSSValue> imageValue;
- if (image.image())
- imageValue = image.image()->cssValue();
-
// Create the slices.
RefPtr<CSSPrimitiveValue> top;
if (image.slices().top().isPercent())
@@ -360,7 +355,22 @@ static PassRefPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image,
rect->setBottom(bottom);
rect->setLeft(left);
- return CSSBorderImageValue::create(imageValue, rect, valueForRepeatRule(image.horizontalRule()), valueForRepeatRule(image.verticalRule()));
+ return CSSBorderImageSliceValue::create(rect, image.fill());
+}
+
+static PassRefPtr<CSSValue> valueForNinePieceImage(const NinePieceImage& image, CSSPrimitiveValueCache* primitiveValueCache)
+{
+ if (!image.hasImage())
+ return primitiveValueCache->createIdentifierValue(CSSValueNone);
+
+ // Image first.
+ RefPtr<CSSValue> imageValue;
+ if (image.image())
+ imageValue = image.image()->cssValue();
+
+ // Create the slices.
+ RefPtr<CSSBorderImageSliceValue> slice = valueForNinePieceImageSlice(image, primitiveValueCache);
+ return CSSBorderImageValue::create(imageValue, slice, valueForRepeatRule(image.horizontalRule()), valueForRepeatRule(image.verticalRule()));
}
inline static PassRefPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(int value, const RenderStyle* style, CSSPrimitiveValueCache* primitiveValueCache)
@@ -1585,8 +1595,12 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(int proper
return primitiveValueCache->createIdentifierValue((style->backfaceVisibility() == BackfaceVisibilityHidden) ? CSSValueHidden : CSSValueVisible);
case CSSPropertyWebkitBorderImage:
return valueForNinePieceImage(style->borderImage(), primitiveValueCache);
+ case CSSPropertyBorderImageSlice:
+ return valueForNinePieceImageSlice(style->borderImage(), primitiveValueCache);
case CSSPropertyWebkitMaskBoxImage:
return valueForNinePieceImage(style->maskBoxImage(), primitiveValueCache);
+ case CSSPropertyWebkitMaskBoxImageSlice:
+ return valueForNinePieceImageSlice(style->maskBoxImage(), primitiveValueCache);
case CSSPropertyWebkitMaskBoxImageSource:
if (style->maskBoxImageSource())
return style->maskBoxImageSource()->cssValue();
diff --git a/third_party/WebKit/Source/WebCore/css/CSSParser.cpp b/third_party/WebKit/Source/WebCore/css/CSSParser.cpp
index 901bd20..e03dda0 100644
--- a/third_party/WebKit/Source/WebCore/css/CSSParser.cpp
+++ b/third_party/WebKit/Source/WebCore/css/CSSParser.cpp
@@ -1451,6 +1451,15 @@ bool CSSParser::parseValue(int propId, bool important)
}
break;
}
+ case CSSPropertyBorderImageSlice:
+ case CSSPropertyWebkitMaskBoxImageSlice: {
+ RefPtr<CSSBorderImageSliceValue> result;
+ if (parseBorderImageSlice(propId, result)) {
+ addProperty(propId, result, important);
+ return true;
+ }
+ break;
+ }
case CSSPropertyBorderTopRightRadius:
case CSSPropertyBorderTopLeftRadius:
case CSSPropertyBorderBottomLeftRadius:
@@ -5118,7 +5127,6 @@ struct BorderImageParseContext {
BorderImageParseContext(CSSPrimitiveValueCache* primitiveValueCache)
: m_primitiveValueCache(primitiveValueCache)
, m_allowBreak(false)
- , m_allowNumber(false)
, m_allowSlash(false)
, m_allowWidth(false)
, m_allowRule(false)
@@ -5131,30 +5139,17 @@ struct BorderImageParseContext {
{}
bool allowBreak() const { return m_allowBreak; }
- bool allowNumber() const { return m_allowNumber; }
bool allowSlash() const { return m_allowSlash; }
bool allowWidth() const { return m_allowWidth; }
bool allowRule() const { return m_allowRule; }
- void commitImage(PassRefPtr<CSSValue> image) { m_image = image; m_allowNumber = true; }
- void commitNumber(CSSParserValue* v)
+ void commitImage(PassRefPtr<CSSValue> image) { m_image = image; }
+ void commitSlice(PassRefPtr<CSSBorderImageSliceValue> slice)
{
- PassRefPtr<CSSPrimitiveValue> val = m_primitiveValueCache->createValue(v->fValue, (CSSPrimitiveValue::UnitTypes)v->unit);
- if (!m_top)
- m_top = val;
- else if (!m_right)
- m_right = val;
- else if (!m_bottom)
- m_bottom = val;
- else {
- ASSERT(!m_left);
- m_left = val;
- }
-
+ m_slice = slice;
m_allowBreak = m_allowSlash = m_allowRule = true;
- m_allowNumber = !m_left;
}
- void commitSlash() { m_allowBreak = m_allowSlash = m_allowNumber = false; m_allowWidth = true; }
+ void commitSlash() { m_allowBreak = m_allowSlash = false; m_allowWidth = true; }
void commitWidth(CSSParserValue* val)
{
if (!m_borderTop)
@@ -5181,26 +5176,6 @@ struct BorderImageParseContext {
}
PassRefPtr<CSSValue> commitBorderImage(CSSParser* p, bool important)
{
- // We need to clone and repeat values for any omissions.
- if (!m_right) {
- m_right = m_primitiveValueCache->createValue(m_top->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_top->primitiveType());
- m_bottom = m_primitiveValueCache->createValue(m_top->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_top->primitiveType());
- m_left = m_primitiveValueCache->createValue(m_top->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_top->primitiveType());
- }
- if (!m_bottom) {
- m_bottom = m_primitiveValueCache->createValue(m_top->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_top->primitiveType());
- m_left = m_primitiveValueCache->createValue(m_right->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_right->primitiveType());
- }
- if (!m_left)
- m_left = m_primitiveValueCache->createValue(m_right->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_right->primitiveType());
-
- // Now build a rect value to hold all four of our primitive values.
- RefPtr<Rect> rect = Rect::create();
- rect->setTop(m_top);
- rect->setRight(m_right);
- rect->setBottom(m_bottom);
- rect->setLeft(m_left);
-
// Fill in STRETCH as the default if it wasn't specified.
if (!m_horizontalRule)
m_horizontalRule = CSSValueStretch;
@@ -5227,23 +5202,18 @@ struct BorderImageParseContext {
}
// Make our new border image value now.
- return CSSBorderImageValue::create(m_image, rect.release(), m_horizontalRule, m_verticalRule);
+ return CSSBorderImageValue::create(m_image, m_slice, m_horizontalRule, m_verticalRule);
}
CSSPrimitiveValueCache* m_primitiveValueCache;
bool m_allowBreak;
- bool m_allowNumber;
bool m_allowSlash;
bool m_allowWidth;
bool m_allowRule;
RefPtr<CSSValue> m_image;
-
- RefPtr<CSSPrimitiveValue> m_top;
- RefPtr<CSSPrimitiveValue> m_right;
- RefPtr<CSSPrimitiveValue> m_bottom;
- RefPtr<CSSPrimitiveValue> m_left;
+ RefPtr<CSSBorderImageSliceValue> m_slice;
CSSParserValue* m_borderTop;
CSSParserValue* m_borderRight;
@@ -5274,10 +5244,15 @@ bool CSSParser::parseBorderImage(int propId, bool important, RefPtr<CSSValue>& r
else
return false;
- while ((val = m_valueList->next())) {
- if (context.allowNumber() && validUnit(val, FInteger | FNonNeg | FPercent, true)) {
- context.commitNumber(val);
- } else if (propId == CSSPropertyWebkitBorderImage && context.allowSlash() && val->unit == CSSParserValue::Operator && val->iValue == '/') {
+ // Parse the slice next.
+ m_valueList->next();
+ RefPtr<CSSBorderImageSliceValue> slice;
+ if (!parseBorderImageSlice(propId, slice))
+ return false;
+ context.commitSlice(slice);
+
+ while ((val = m_valueList->current())) {
+ if (propId == CSSPropertyWebkitBorderImage && context.allowSlash() && val->unit == CSSParserValue::Operator && val->iValue == '/') {
context.commitSlash();
} else if (context.allowWidth() &&
(val->id == CSSValueThin || val->id == CSSValueMedium || val->id == CSSValueThick || validUnit(val, FLength, m_strict))) {
@@ -5289,17 +5264,130 @@ bool CSSParser::parseBorderImage(int propId, bool important, RefPtr<CSSValue>& r
// Something invalid was encountered.
return false;
}
+ m_valueList->next();
}
- if (context.allowNumber() && propId != CSSPropertyWebkitBorderImage) {
+ if (context.allowBreak()) {
+ // Need to fully commit as a single value.
+ result = context.commitBorderImage(this, important);
+ return true;
+ }
+
+ return false;
+}
+
+class BorderImageSliceParseContext {
+public:
+ BorderImageSliceParseContext(CSSPrimitiveValueCache* primitiveValueCache)
+ : m_primitiveValueCache(primitiveValueCache)
+ , m_allowNumber(true)
+ , m_allowFill(false)
+ , m_allowFinalCommit(false)
+ , m_fill(false)
+ { }
+
+ bool allowNumber() const { return m_allowNumber; }
+ bool allowFill() const { return m_allowFill; }
+ bool allowFinalCommit() const { return m_allowFinalCommit; }
+ CSSPrimitiveValue* top() const { return m_top.get(); }
+
+ void commitNumber(CSSParserValue* v)
+ {
+ RefPtr<CSSPrimitiveValue> val = m_primitiveValueCache->createValue(v->fValue, (CSSPrimitiveValue::UnitTypes)v->unit);
+ if (!m_top)
+ m_top = val;
+ else if (!m_right)
+ m_right = val;
+ else if (!m_bottom)
+ m_bottom = val;
+ else {
+ ASSERT(!m_left);
+ m_left = val;
+ }
+
+ m_allowNumber = !m_left;
+ m_allowFill = true;
+ m_allowFinalCommit = true;
+ }
+
+ void commitFill() { m_fill = true; m_allowFill = false; m_allowNumber = false; }
+
+ void setAllowFinalCommit() { m_allowFinalCommit = true; }
+ void setTop(PassRefPtr<CSSPrimitiveValue> val) { m_top = val; }
+
+ PassRefPtr<CSSBorderImageSliceValue> commitBorderImageSlice()
+ {
+ // We need to clone and repeat values for any omissions.
+ ASSERT(m_top);
+ if (!m_right) {
+ m_right = m_primitiveValueCache->createValue(m_top->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_top->primitiveType());
+ m_bottom = m_primitiveValueCache->createValue(m_top->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_top->primitiveType());
+ m_left = m_primitiveValueCache->createValue(m_top->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_top->primitiveType());
+ }
+ if (!m_bottom) {
+ m_bottom = m_primitiveValueCache->createValue(m_top->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_top->primitiveType());
+ m_left = m_primitiveValueCache->createValue(m_right->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_right->primitiveType());
+ }
+ if (!m_left)
+ m_left = m_primitiveValueCache->createValue(m_right->getDoubleValue(), (CSSPrimitiveValue::UnitTypes)m_right->primitiveType());
+
+ // Now build a rect value to hold all four of our primitive values.
+ RefPtr<Rect> rect = Rect::create();
+ rect->setTop(m_top);
+ rect->setRight(m_right);
+ rect->setBottom(m_bottom);
+ rect->setLeft(m_left);
+
+ // Make our new border image value now.
+ return CSSBorderImageSliceValue::create(rect.release(), m_fill);
+ }
+
+private:
+ CSSPrimitiveValueCache* m_primitiveValueCache;
+
+ bool m_allowNumber;
+ bool m_allowFill;
+ bool m_allowFinalCommit;
+
+ RefPtr<CSSPrimitiveValue> m_top;
+ RefPtr<CSSPrimitiveValue> m_right;
+ RefPtr<CSSPrimitiveValue> m_bottom;
+ RefPtr<CSSPrimitiveValue> m_left;
+
+ bool m_fill;
+};
+
+bool CSSParser::parseBorderImageSlice(int propId, RefPtr<CSSBorderImageSliceValue>& result)
+{
+ BorderImageSliceParseContext context(primitiveValueCache());
+ CSSParserValue* val;
+ while ((val = m_valueList->current())) {
+ if (context.allowNumber() && validUnit(val, FInteger | FNonNeg | FPercent, true)) {
+ context.commitNumber(val);
+ } else if (context.allowFill() && val->id == CSSValueFill)
+ context.commitFill();
+ else if (propId == CSSPropertyBorderImageSlice || propId == CSSPropertyWebkitMaskBoxImageSlice) {
+ // If we're not parsing a shorthand then we are invalid.
+ return false;
+ } else
+ break;
+ m_valueList->next();
+ }
+
+ if (context.allowNumber() && !context.top() && (propId == CSSPropertyWebkitMaskBoxImage || propId == CSSPropertyWebkitBoxReflect)) {
// Allow the slices to be omitted for images that don't fit to a border. We just set the slices to be 0.
- context.m_top = primitiveValueCache()->createValue(0, CSSPrimitiveValue::CSS_NUMBER);
- context.m_allowBreak = true;
+ context.setTop(primitiveValueCache()->createValue(0, CSSPrimitiveValue::CSS_NUMBER));
+ context.setAllowFinalCommit();
}
- if (context.allowBreak()) {
+ if (context.allowFinalCommit()) {
+ // FIXME: For backwards compatibility, -webkit-border-image, -webkit-mask-box-image and -webkit-box-reflect have to do a fill by default.
+ // FIXME: What do we do with -webkit-box-reflect and -webkit-mask-box-image? Probably just have to leave them filling...
+ if (propId == CSSPropertyWebkitBorderImage || propId == CSSPropertyWebkitMaskBoxImage || propId == CSSPropertyWebkitBoxReflect)
+ context.commitFill();
+
// Need to fully commit as a single value.
- result = context.commitBorderImage(this, important);
+ result = context.commitBorderImageSlice();
return true;
}
diff --git a/third_party/WebKit/Source/WebCore/css/CSSParser.h b/third_party/WebKit/Source/WebCore/css/CSSParser.h
index 8e3fe77..ad0256f 100644
--- a/third_party/WebKit/Source/WebCore/css/CSSParser.h
+++ b/third_party/WebKit/Source/WebCore/css/CSSParser.h
@@ -36,372 +36,374 @@
namespace WebCore {
- class CSSMutableStyleDeclaration;
- class CSSPrimitiveValue;
- class CSSPrimitiveValueCache;
- class CSSProperty;
- class CSSRule;
- class CSSRuleList;
- class CSSSelectorList;
- class CSSStyleSheet;
- class CSSValue;
- class CSSValueList;
- class Document;
- class MediaList;
- class MediaQueryExp;
- class StyleBase;
- class WebKitCSSKeyframeRule;
- class WebKitCSSKeyframesRule;
- class CSSWrapShape;
-
- class CSSParser {
- public:
- CSSParser(bool strictParsing = true);
- ~CSSParser();
-
- void parseSheet(CSSStyleSheet*, const String&, int startLineNumber = 0, StyleRuleRangeMap* ruleRangeMap = 0);
- PassRefPtr<CSSRule> parseRule(CSSStyleSheet*, const String&);
- PassRefPtr<CSSRule> parseKeyframeRule(CSSStyleSheet*, const String&);
- static bool parseValue(CSSMutableStyleDeclaration*, int propId, const String&, bool important, bool strict);
- static bool parseColor(RGBA32& color, const String&, bool strict = false);
- static bool parseSystemColor(RGBA32& color, const String&, Document*);
- PassRefPtr<CSSPrimitiveValue> parseValidPrimitive(int propId, CSSParserValue*);
- bool parseColor(CSSMutableStyleDeclaration*, const String&);
- bool parseDeclaration(CSSMutableStyleDeclaration*, const String&, RefPtr<CSSStyleSourceData>* styleSourceData = 0);
- bool parseMediaQuery(MediaList*, const String&);
-
- Document* document() const;
+class CSSBorderImageSliceValue;
+class CSSMutableStyleDeclaration;
+class CSSPrimitiveValue;
+class CSSPrimitiveValueCache;
+class CSSProperty;
+class CSSRule;
+class CSSRuleList;
+class CSSSelectorList;
+class CSSStyleSheet;
+class CSSValue;
+class CSSValueList;
+class Document;
+class MediaList;
+class MediaQueryExp;
+class StyleBase;
+class WebKitCSSKeyframeRule;
+class WebKitCSSKeyframesRule;
+class CSSWrapShape;
+
+class CSSParser {
+public:
+ CSSParser(bool strictParsing = true);
+ ~CSSParser();
+
+ void parseSheet(CSSStyleSheet*, const String&, int startLineNumber = 0, StyleRuleRangeMap* ruleRangeMap = 0);
+ PassRefPtr<CSSRule> parseRule(CSSStyleSheet*, const String&);
+ PassRefPtr<CSSRule> parseKeyframeRule(CSSStyleSheet*, const String&);
+ static bool parseValue(CSSMutableStyleDeclaration*, int propId, const String&, bool important, bool strict);
+ static bool parseColor(RGBA32& color, const String&, bool strict = false);
+ static bool parseSystemColor(RGBA32& color, const String&, Document*);
+ PassRefPtr<CSSPrimitiveValue> parseValidPrimitive(int propId, CSSParserValue*);
+ bool parseColor(CSSMutableStyleDeclaration*, const String&);
+ bool parseDeclaration(CSSMutableStyleDeclaration*, const String&, RefPtr<CSSStyleSourceData>* styleSourceData = 0);
+ bool parseMediaQuery(MediaList*, const String&);
+
+ Document* document() const;
+
+ CSSPrimitiveValueCache* primitiveValueCache() const { return m_primitiveValueCache.get(); }
+
+ void addProperty(int propId, PassRefPtr<CSSValue>, bool important);
+ void rollbackLastProperties(int num);
+ bool hasProperties() const { return m_numParsedProperties > 0; }
+
+ bool parseValue(int propId, bool important);
+ bool parseShorthand(int propId, const int* properties, int numProperties, bool important);
+ bool parse4Values(int propId, const int* properties, bool important);
+ bool parseContent(int propId, bool important);
+ bool parseQuotes(int propId, bool important);
+
+ PassRefPtr<CSSValue> parseAttr(CSSParserValueList* args);
+
+ PassRefPtr<CSSValue> parseBackgroundColor();
+
+ bool parseFillImage(RefPtr<CSSValue>&);
+
+ enum FillPositionFlag { InvalidFillPosition = 0, AmbiguousFillPosition = 1, XFillPosition = 2, YFillPosition = 4 };
+ PassRefPtr<CSSValue> parseFillPositionComponent(CSSParserValueList*, unsigned& cumulativeFlags, FillPositionFlag& individualFlag);
+ PassRefPtr<CSSValue> parseFillPositionX(CSSParserValueList*);
+ PassRefPtr<CSSValue> parseFillPositionY(CSSParserValueList*);
+ void parseFillPosition(CSSParserValueList*, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
- CSSPrimitiveValueCache* primitiveValueCache() const { return m_primitiveValueCache.get(); }
+ void parseFillRepeat(RefPtr<CSSValue>&, RefPtr<CSSValue>&);
+ PassRefPtr<CSSValue> parseFillSize(int propId, bool &allowComma);
- void addProperty(int propId, PassRefPtr<CSSValue>, bool important);
- void rollbackLastProperties(int num);
- bool hasProperties() const { return m_numParsedProperties > 0; }
+ bool parseFillProperty(int propId, int& propId1, int& propId2, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
+ bool parseFillShorthand(int propId, const int* properties, int numProperties, bool important);
- bool parseValue(int propId, bool important);
- bool parseShorthand(int propId, const int* properties, int numProperties, bool important);
- bool parse4Values(int propId, const int* properties, bool important);
- bool parseContent(int propId, bool important);
- bool parseQuotes(int propId, bool important);
+ void addFillValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> rval);
- PassRefPtr<CSSValue> parseAttr(CSSParserValueList* args);
+ void addAnimationValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> rval);
- PassRefPtr<CSSValue> parseBackgroundColor();
+ PassRefPtr<CSSValue> parseAnimationDelay();
+ PassRefPtr<CSSValue> parseAnimationDirection();
+ PassRefPtr<CSSValue> parseAnimationDuration();
+ PassRefPtr<CSSValue> parseAnimationFillMode();
+ PassRefPtr<CSSValue> parseAnimationIterationCount();
+ PassRefPtr<CSSValue> parseAnimationName();
+ PassRefPtr<CSSValue> parseAnimationPlayState();
+ PassRefPtr<CSSValue> parseAnimationProperty();
+ PassRefPtr<CSSValue> parseAnimationTimingFunction();
- bool parseFillImage(RefPtr<CSSValue>&);
+ bool parseTransformOriginShorthand(RefPtr<CSSValue>&, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
+ bool parseCubicBezierTimingFunctionValue(CSSParserValueList*& args, double& result);
+ bool parseAnimationProperty(int propId, RefPtr<CSSValue>&);
+ bool parseTransitionShorthand(bool important);
+ bool parseAnimationShorthand(bool important);
- enum FillPositionFlag { InvalidFillPosition = 0, AmbiguousFillPosition = 1, XFillPosition = 2, YFillPosition = 4 };
- PassRefPtr<CSSValue> parseFillPositionComponent(CSSParserValueList*, unsigned& cumulativeFlags, FillPositionFlag& individualFlag);
- PassRefPtr<CSSValue> parseFillPositionX(CSSParserValueList*);
- PassRefPtr<CSSValue> parseFillPositionY(CSSParserValueList*);
- void parseFillPosition(CSSParserValueList*, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
-
- void parseFillRepeat(RefPtr<CSSValue>&, RefPtr<CSSValue>&);
- PassRefPtr<CSSValue> parseFillSize(int propId, bool &allowComma);
+ bool parseDashboardRegions(int propId, bool important);
- bool parseFillProperty(int propId, int& propId1, int& propId2, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
- bool parseFillShorthand(int propId, const int* properties, int numProperties, bool important);
+ bool parseShape(int propId, bool important);
- void addFillValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> rval);
+ bool parseWrapShape(bool important);
+ PassRefPtr<CSSWrapShape> parseWrapShapeRect(CSSParserValueList* args);
+ PassRefPtr<CSSWrapShape> parseWrapShapeCircle(CSSParserValueList* args);
+ PassRefPtr<CSSWrapShape> parseWrapShapeEllipse(CSSParserValueList* args);
+ PassRefPtr<CSSWrapShape> parseWrapShapePolygon(CSSParserValueList* args);
- void addAnimationValue(RefPtr<CSSValue>& lval, PassRefPtr<CSSValue> rval);
+ bool parseFont(bool important);
+ PassRefPtr<CSSValueList> parseFontFamily();
- PassRefPtr<CSSValue> parseAnimationDelay();
- PassRefPtr<CSSValue> parseAnimationDirection();
- PassRefPtr<CSSValue> parseAnimationDuration();
- PassRefPtr<CSSValue> parseAnimationFillMode();
- PassRefPtr<CSSValue> parseAnimationIterationCount();
- PassRefPtr<CSSValue> parseAnimationName();
- PassRefPtr<CSSValue> parseAnimationPlayState();
- PassRefPtr<CSSValue> parseAnimationProperty();
- PassRefPtr<CSSValue> parseAnimationTimingFunction();
+ bool parseCounter(int propId, int defaultValue, bool important);
+ PassRefPtr<CSSValue> parseCounterContent(CSSParserValueList* args, bool counters);
- bool parseTransformOriginShorthand(RefPtr<CSSValue>&, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
- bool parseCubicBezierTimingFunctionValue(CSSParserValueList*& args, double& result);
- bool parseAnimationProperty(int propId, RefPtr<CSSValue>&);
- bool parseTransitionShorthand(bool important);
- bool parseAnimationShorthand(bool important);
+ bool parseColorParameters(CSSParserValue*, int* colorValues, bool parseAlpha);
+ bool parseHSLParameters(CSSParserValue*, double* colorValues, bool parseAlpha);
+ PassRefPtr<CSSPrimitiveValue> parseColor(CSSParserValue* = 0);
+ bool parseColorFromValue(CSSParserValue*, RGBA32&);
+ void parseSelector(const String&, Document* doc, CSSSelectorList&);
- bool parseDashboardRegions(int propId, bool important);
+ static bool parseColor(const String&, RGBA32& rgb, bool strict);
- bool parseShape(int propId, bool important);
+ bool parseFontStyle(bool important);
+ bool parseFontVariant(bool important);
+ bool parseFontWeight(bool important);
+ bool parseFontFaceSrc();
+ bool parseFontFaceUnicodeRange();
- bool parseWrapShape(bool important);
- PassRefPtr<CSSWrapShape> parseWrapShapeRect(CSSParserValueList* args);
- PassRefPtr<CSSWrapShape> parseWrapShapeCircle(CSSParserValueList* args);
- PassRefPtr<CSSWrapShape> parseWrapShapeEllipse(CSSParserValueList* args);
- PassRefPtr<CSSWrapShape> parseWrapShapePolygon(CSSParserValueList* args);
+#if ENABLE(SVG)
+ bool parseSVGValue(int propId, bool important);
+ PassRefPtr<CSSValue> parseSVGPaint();
+ PassRefPtr<CSSValue> parseSVGColor();
+ PassRefPtr<CSSValue> parseSVGStrokeDasharray();
+#endif
- bool parseFont(bool important);
- PassRefPtr<CSSValueList> parseFontFamily();
+#if ENABLE(WCSS)
+ PassRefPtr<CSSValue> parseWCSSInputProperty();
+#endif
- bool parseCounter(int propId, int defaultValue, bool important);
- PassRefPtr<CSSValue> parseCounterContent(CSSParserValueList* args, bool counters);
+ // CSS3 Parsing Routines (for properties specific to CSS3)
+ bool parseShadow(int propId, bool important);
+ bool parseBorderImage(int propId, bool important, RefPtr<CSSValue>&);
+ bool parseBorderImageSlice(int propId, RefPtr<CSSBorderImageSliceValue>&);
+ bool parseBorderRadius(int propId, bool important);
- bool parseColorParameters(CSSParserValue*, int* colorValues, bool parseAlpha);
- bool parseHSLParameters(CSSParserValue*, double* colorValues, bool parseAlpha);
- PassRefPtr<CSSPrimitiveValue> parseColor(CSSParserValue* = 0);
- bool parseColorFromValue(CSSParserValue*, RGBA32&);
- void parseSelector(const String&, Document* doc, CSSSelectorList&);
+ bool parseReflect(int propId, bool important);
- static bool parseColor(const String&, RGBA32& rgb, bool strict);
+ bool parseFlex(int propId, bool important);
- bool parseFontStyle(bool important);
- bool parseFontVariant(bool important);
- bool parseFontWeight(bool important);
- bool parseFontFaceSrc();
- bool parseFontFaceUnicodeRange();
+ // Image generators
+ bool parseCanvas(RefPtr<CSSValue>&);
-#if ENABLE(SVG)
- bool parseSVGValue(int propId, bool important);
- PassRefPtr<CSSValue> parseSVGPaint();
- PassRefPtr<CSSValue> parseSVGColor();
- PassRefPtr<CSSValue> parseSVGStrokeDasharray();
-#endif
+ bool parseDeprecatedGradient(RefPtr<CSSValue>&);
+ bool parseLinearGradient(RefPtr<CSSValue>&, CSSGradientRepeat repeating);
+ bool parseRadialGradient(RefPtr<CSSValue>&, CSSGradientRepeat repeating);
+ bool parseGradientColorStops(CSSParserValueList*, CSSGradientValue*, bool expectComma);
+
+ PassRefPtr<CSSValueList> parseTransform();
+ bool parseTransformOrigin(int propId, int& propId1, int& propId2, int& propId3, RefPtr<CSSValue>&, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
+ bool parsePerspectiveOrigin(int propId, int& propId1, int& propId2, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
+
+ bool parseTextEmphasisStyle(bool important);
+
+ bool parseLineBoxContain(bool important);
+
+ bool parseFontFeatureTag(CSSValueList*);
+ bool parseFontFeatureSettings(bool important);
+
+ bool parseFlowThread(int propId, bool important);
+ PassRefPtr<CSSValue> parseFromFlowContent(CSSParserValueList*);
+
+ int yyparse();
+
+ CSSParserSelector* createFloatingSelector();
+ PassOwnPtr<CSSParserSelector> sinkFloatingSelector(CSSParserSelector*);
+
+ Vector<OwnPtr<CSSParserSelector> >* createFloatingSelectorVector();
+ PassOwnPtr<Vector<OwnPtr<CSSParserSelector> > > sinkFloatingSelectorVector(Vector<OwnPtr<CSSParserSelector> >*);
+
+ CSSParserValueList* createFloatingValueList();
+ CSSParserValueList* sinkFloatingValueList(CSSParserValueList*);
+
+ CSSParserFunction* createFloatingFunction();
+ CSSParserFunction* sinkFloatingFunction(CSSParserFunction*);
+
+ CSSParserValue& sinkFloatingValue(CSSParserValue&);
+
+ MediaList* createMediaList();
+ CSSRule* createCharsetRule(const CSSParserString&);
+ CSSRule* createImportRule(const CSSParserString&, MediaList*);
+ WebKitCSSKeyframeRule* createKeyframeRule(CSSParserValueList*);
+ WebKitCSSKeyframesRule* createKeyframesRule();
+ CSSRule* createMediaRule(MediaList*, CSSRuleList*);
+ CSSRuleList* createRuleList();
+ CSSRule* createStyleRule(Vector<OwnPtr<CSSParserSelector> >* selectors);
+ CSSRule* createFontFaceRule();
+ CSSRule* createPageRule(PassOwnPtr<CSSParserSelector> pageSelector);
+ CSSRule* createMarginAtRule(CSSSelector::MarginBoxType marginBox);
+ void startDeclarationsForMarginBox();
+ void endDeclarationsForMarginBox();
+
+ MediaQueryExp* createFloatingMediaQueryExp(const AtomicString&, CSSParserValueList*);
+ PassOwnPtr<MediaQueryExp> sinkFloatingMediaQueryExp(MediaQueryExp*);
+ Vector<OwnPtr<MediaQueryExp> >* createFloatingMediaQueryExpList();
+ PassOwnPtr<Vector<OwnPtr<MediaQueryExp> > > sinkFloatingMediaQueryExpList(Vector<OwnPtr<MediaQueryExp> >*);
+ MediaQuery* createFloatingMediaQuery(MediaQuery::Restrictor, const String&, PassOwnPtr<Vector<OwnPtr<MediaQueryExp> > >);
+ MediaQuery* createFloatingMediaQuery(PassOwnPtr<Vector<OwnPtr<MediaQueryExp> > >);
+ PassOwnPtr<MediaQuery> sinkFloatingMediaQuery(MediaQuery*);
+
+ void addNamespace(const AtomicString& prefix, const AtomicString& uri);
+ void updateSpecifiersWithElementName(const AtomicString& namespacePrefix, const AtomicString& elementName, CSSParserSelector*);
+ CSSParserSelector* updateSpecifiers(CSSParserSelector*, CSSParserSelector*);
+
+ void invalidBlockHit();
+
+ Vector<OwnPtr<CSSParserSelector> >* reusableSelectorVector() { return &m_reusableSelectorVector; }
+
+ void updateLastSelectorLineAndPosition();
+
+ void clearProperties();
+
+ bool m_strict;
+ bool m_important;
+ int m_id;
+ CSSStyleSheet* m_styleSheet;
+ RefPtr<CSSRule> m_rule;
+ RefPtr<CSSRule> m_keyframe;
+ OwnPtr<MediaQuery> m_mediaQuery;
+ CSSParserValueList* m_valueList;
+ CSSProperty** m_parsedProperties;
+ CSSSelectorList* m_selectorListForParseSelector;
+ RefPtr<CSSPrimitiveValueCache> m_primitiveValueCache;
+ unsigned m_numParsedProperties;
+ unsigned m_maxParsedProperties;
+ unsigned m_numParsedPropertiesBeforeMarginBox;
+
+ int m_inParseShorthand;
+ int m_currentShorthand;
+ bool m_implicitShorthand;
+
+ bool m_hasFontFaceOnlyValues;
+ bool m_hadSyntacticallyValidCSSRule;
+
+ AtomicString m_defaultNamespace;
+
+ // tokenizer methods and data
+ bool m_inStyleRuleOrDeclaration;
+ SourceRange m_selectorListRange;
+ SourceRange m_ruleBodyRange;
+ SourceRange m_propertyRange;
+ StyleRuleRangeMap* m_ruleRangeMap;
+ RefPtr<CSSRuleSourceData> m_currentRuleData;
+ void markSelectorListStart();
+ void markSelectorListEnd();
+ void markRuleBodyStart();
+ void markRuleBodyEnd();
+ void markPropertyStart();
+ void markPropertyEnd(bool isImportantFound, bool isPropertyParsed);
+ void resetSelectorListMarks() { m_selectorListRange.start = m_selectorListRange.end = 0; }
+ void resetRuleBodyMarks() { m_ruleBodyRange.start = m_ruleBodyRange.end = 0; }
+ void resetPropertyMarks() { m_propertyRange.start = m_propertyRange.end = UINT_MAX; }
+ int lex(void* yylval);
+ int token() { return yyTok; }
+ UChar* text(int* length);
+ void countLines();
+ int lex();
+
+private:
+ void setStyleSheet(CSSStyleSheet*);
+
+ void recheckAtKeyword(const UChar* str, int len);
-#if ENABLE(WCSS)
- PassRefPtr<CSSValue> parseWCSSInputProperty();
-#endif
+ void setupParser(const char* prefix, const String&, const char* suffix);
- // CSS3 Parsing Routines (for properties specific to CSS3)
- bool parseShadow(int propId, bool important);
- bool parseBorderImage(int propId, bool important, RefPtr<CSSValue>&);
- bool parseBorderRadius(int propId, bool important);
+ bool inShorthand() const { return m_inParseShorthand; }
- bool parseReflect(int propId, bool important);
+ void checkForOrphanedUnits();
- bool parseFlex(int propId, bool important);
+ void deleteFontFaceOnlyValues();
- // Image generators
- bool parseCanvas(RefPtr<CSSValue>&);
+ bool isGeneratedImageValue(CSSParserValue*) const;
+ bool parseGeneratedImage(RefPtr<CSSValue>&);
- bool parseDeprecatedGradient(RefPtr<CSSValue>&);
- bool parseLinearGradient(RefPtr<CSSValue>&, CSSGradientRepeat repeating);
- bool parseRadialGradient(RefPtr<CSSValue>&, CSSGradientRepeat repeating);
- bool parseGradientColorStops(CSSParserValueList*, CSSGradientValue*, bool expectComma);
-
- PassRefPtr<CSSValueList> parseTransform();
- bool parseTransformOrigin(int propId, int& propId1, int& propId2, int& propId3, RefPtr<CSSValue>&, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
- bool parsePerspectiveOrigin(int propId, int& propId1, int& propId2, RefPtr<CSSValue>&, RefPtr<CSSValue>&);
-
- bool parseTextEmphasisStyle(bool important);
-
- bool parseLineBoxContain(bool important);
-
- bool parseFontFeatureTag(CSSValueList*);
- bool parseFontFeatureSettings(bool important);
-
- bool parseFlowThread(int propId, bool important);
- PassRefPtr<CSSValue> parseFromFlowContent(CSSParserValueList*);
-
- int yyparse();
-
- CSSParserSelector* createFloatingSelector();
- PassOwnPtr<CSSParserSelector> sinkFloatingSelector(CSSParserSelector*);
-
- Vector<OwnPtr<CSSParserSelector> >* createFloatingSelectorVector();
- PassOwnPtr<Vector<OwnPtr<CSSParserSelector> > > sinkFloatingSelectorVector(Vector<OwnPtr<CSSParserSelector> >*);
-
- CSSParserValueList* createFloatingValueList();
- CSSParserValueList* sinkFloatingValueList(CSSParserValueList*);
-
- CSSParserFunction* createFloatingFunction();
- CSSParserFunction* sinkFloatingFunction(CSSParserFunction*);
+ bool parseValue(CSSMutableStyleDeclaration*, int propId, const String&, bool important);
- CSSParserValue& sinkFloatingValue(CSSParserValue&);
-
- MediaList* createMediaList();
- CSSRule* createCharsetRule(const CSSParserString&);
- CSSRule* createImportRule(const CSSParserString&, MediaList*);
- WebKitCSSKeyframeRule* createKeyframeRule(CSSParserValueList*);
- WebKitCSSKeyframesRule* createKeyframesRule();
- CSSRule* createMediaRule(MediaList*, CSSRuleList*);
- CSSRuleList* createRuleList();
- CSSRule* createStyleRule(Vector<OwnPtr<CSSParserSelector> >* selectors);
- CSSRule* createFontFaceRule();
- CSSRule* createPageRule(PassOwnPtr<CSSParserSelector> pageSelector);
- CSSRule* createMarginAtRule(CSSSelector::MarginBoxType marginBox);
- void startDeclarationsForMarginBox();
- void endDeclarationsForMarginBox();
-
- MediaQueryExp* createFloatingMediaQueryExp(const AtomicString&, CSSParserValueList*);
- PassOwnPtr<MediaQueryExp> sinkFloatingMediaQueryExp(MediaQueryExp*);
- Vector<OwnPtr<MediaQueryExp> >* createFloatingMediaQueryExpList();
- PassOwnPtr<Vector<OwnPtr<MediaQueryExp> > > sinkFloatingMediaQueryExpList(Vector<OwnPtr<MediaQueryExp> >*);
- MediaQuery* createFloatingMediaQuery(MediaQuery::Restrictor, const String&, PassOwnPtr<Vector<OwnPtr<MediaQueryExp> > >);
- MediaQuery* createFloatingMediaQuery(PassOwnPtr<Vector<OwnPtr<MediaQueryExp> > >);
- PassOwnPtr<MediaQuery> sinkFloatingMediaQuery(MediaQuery*);
-
- void addNamespace(const AtomicString& prefix, const AtomicString& uri);
- void updateSpecifiersWithElementName(const AtomicString& namespacePrefix, const AtomicString& elementName, CSSParserSelector*);
- CSSParserSelector* updateSpecifiers(CSSParserSelector*, CSSParserSelector*);
-
- void invalidBlockHit();
-
- Vector<OwnPtr<CSSParserSelector> >* reusableSelectorVector() { return &m_reusableSelectorVector; }
-
- void updateLastSelectorLineAndPosition();
-
- void clearProperties();
-
- bool m_strict;
- bool m_important;
- int m_id;
- CSSStyleSheet* m_styleSheet;
- RefPtr<CSSRule> m_rule;
- RefPtr<CSSRule> m_keyframe;
- OwnPtr<MediaQuery> m_mediaQuery;
- CSSParserValueList* m_valueList;
- CSSProperty** m_parsedProperties;
- CSSSelectorList* m_selectorListForParseSelector;
- RefPtr<CSSPrimitiveValueCache> m_primitiveValueCache;
- unsigned m_numParsedProperties;
- unsigned m_maxParsedProperties;
- unsigned m_numParsedPropertiesBeforeMarginBox;
-
- int m_inParseShorthand;
- int m_currentShorthand;
- bool m_implicitShorthand;
-
- bool m_hasFontFaceOnlyValues;
- bool m_hadSyntacticallyValidCSSRule;
-
- AtomicString m_defaultNamespace;
-
- // tokenizer methods and data
- bool m_inStyleRuleOrDeclaration;
- SourceRange m_selectorListRange;
- SourceRange m_ruleBodyRange;
- SourceRange m_propertyRange;
- StyleRuleRangeMap* m_ruleRangeMap;
- RefPtr<CSSRuleSourceData> m_currentRuleData;
- void markSelectorListStart();
- void markSelectorListEnd();
- void markRuleBodyStart();
- void markRuleBodyEnd();
- void markPropertyStart();
- void markPropertyEnd(bool isImportantFound, bool isPropertyParsed);
- void resetSelectorListMarks() { m_selectorListRange.start = m_selectorListRange.end = 0; }
- void resetRuleBodyMarks() { m_ruleBodyRange.start = m_ruleBodyRange.end = 0; }
- void resetPropertyMarks() { m_propertyRange.start = m_propertyRange.end = UINT_MAX; }
- int lex(void* yylval);
- int token() { return yyTok; }
- UChar* text(int* length);
- void countLines();
- int lex();
-
- private:
- void setStyleSheet(CSSStyleSheet*);
-
- void recheckAtKeyword(const UChar* str, int len);
-
- void setupParser(const char* prefix, const String&, const char* suffix);
-
- bool inShorthand() const { return m_inParseShorthand; }
-
- void checkForOrphanedUnits();
-
- void deleteFontFaceOnlyValues();
-
- bool isGeneratedImageValue(CSSParserValue*) const;
- bool parseGeneratedImage(RefPtr<CSSValue>&);
-
- bool parseValue(CSSMutableStyleDeclaration*, int propId, const String&, bool important);
-
- enum SizeParameterType {
- None,
- Auto,
- Length,
- PageSize,
- Orientation,
- };
-
- bool parsePage(int propId, bool important);
- bool parseSize(int propId, bool important);
- SizeParameterType parseSizeParameter(CSSValueList* parsedValues, CSSParserValue* value, SizeParameterType prevParamType);
-
- UChar* m_data;
- UChar* yytext;
- UChar* yy_c_buf_p;
- UChar yy_hold_char;
- int yy_last_accepting_state;
- UChar* yy_last_accepting_cpos;
- int yyleng;
- int yyTok;
- int yy_start;
- int m_lineNumber;
- int m_lastSelectorLineNumber;
-
- bool m_allowImportRules;
- bool m_allowNamespaceDeclarations;
-
- Vector<RefPtr<StyleBase> > m_parsedStyleObjects;
- Vector<RefPtr<CSSRuleList> > m_parsedRuleLists;
- HashSet<CSSParserSelector*> m_floatingSelectors;
- HashSet<Vector<OwnPtr<CSSParserSelector> >*> m_floatingSelectorVectors;
- HashSet<CSSParserValueList*> m_floatingValueLists;
- HashSet<CSSParserFunction*> m_floatingFunctions;
-
- OwnPtr<MediaQuery> m_floatingMediaQuery;
- OwnPtr<MediaQueryExp> m_floatingMediaQueryExp;
- OwnPtr<Vector<OwnPtr<MediaQueryExp> > > m_floatingMediaQueryExpList;
-
- Vector<OwnPtr<CSSParserSelector> > m_reusableSelectorVector;
-
- // defines units allowed for a certain property, used in parseUnit
- enum Units {
- FUnknown = 0x0000,
- FInteger = 0x0001,
- FNumber = 0x0002, // Real Numbers
- FPercent = 0x0004,
- FLength = 0x0008,
- FAngle = 0x0010,
- FTime = 0x0020,
- FFrequency = 0x0040,
- FRelative = 0x0100,
- FNonNeg = 0x0200
- };
-
- friend inline Units operator|(Units a, Units b)
- {
- return static_cast<Units>(static_cast<unsigned>(a) | static_cast<unsigned>(b));
- }
-
- static bool validUnit(CSSParserValue*, Units, bool strict);
-
- PassRefPtr<CSSPrimitiveValue> createPrimitiveNumericValue(CSSParserValue*);
- PassRefPtr<CSSPrimitiveValue> createPrimitiveStringValue(CSSParserValue*);
-
- friend class TransformOperationInfo;
+ enum SizeParameterType {
+ None,
+ Auto,
+ Length,
+ PageSize,
+ Orientation,
};
- int cssPropertyID(const CSSParserString&);
- int cssPropertyID(const String&);
- int cssValueKeywordID(const CSSParserString&);
-
- class ShorthandScope {
- WTF_MAKE_FAST_ALLOCATED;
- public:
- ShorthandScope(CSSParser* parser, int propId) : m_parser(parser)
- {
- if (!(m_parser->m_inParseShorthand++))
- m_parser->m_currentShorthand = propId;
- }
- ~ShorthandScope()
- {
- if (!(--m_parser->m_inParseShorthand))
- m_parser->m_currentShorthand = 0;
- }
-
- private:
- CSSParser* m_parser;
+ bool parsePage(int propId, bool important);
+ bool parseSize(int propId, bool important);
+ SizeParameterType parseSizeParameter(CSSValueList* parsedValues, CSSParserValue* value, SizeParameterType prevParamType);
+
+ UChar* m_data;
+ UChar* yytext;
+ UChar* yy_c_buf_p;
+ UChar yy_hold_char;
+ int yy_last_accepting_state;
+ UChar* yy_last_accepting_cpos;
+ int yyleng;
+ int yyTok;
+ int yy_start;
+ int m_lineNumber;
+ int m_lastSelectorLineNumber;
+
+ bool m_allowImportRules;
+ bool m_allowNamespaceDeclarations;
+
+ Vector<RefPtr<StyleBase> > m_parsedStyleObjects;
+ Vector<RefPtr<CSSRuleList> > m_parsedRuleLists;
+ HashSet<CSSParserSelector*> m_floatingSelectors;
+ HashSet<Vector<OwnPtr<CSSParserSelector> >*> m_floatingSelectorVectors;
+ HashSet<CSSParserValueList*> m_floatingValueLists;
+ HashSet<CSSParserFunction*> m_floatingFunctions;
+
+ OwnPtr<MediaQuery> m_floatingMediaQuery;
+ OwnPtr<MediaQueryExp> m_floatingMediaQueryExp;
+ OwnPtr<Vector<OwnPtr<MediaQueryExp> > > m_floatingMediaQueryExpList;
+
+ Vector<OwnPtr<CSSParserSelector> > m_reusableSelectorVector;
+
+ // defines units allowed for a certain property, used in parseUnit
+ enum Units {
+ FUnknown = 0x0000,
+ FInteger = 0x0001,
+ FNumber = 0x0002, // Real Numbers
+ FPercent = 0x0004,
+ FLength = 0x0008,
+ FAngle = 0x0010,
+ FTime = 0x0020,
+ FFrequency = 0x0040,
+ FRelative = 0x0100,
+ FNonNeg = 0x0200
};
- String quoteCSSString(const String&);
- String quoteCSSStringIfNeeded(const String&);
- String quoteCSSURLIfNeeded(const String&);
-
- bool isValidNthToken(const CSSParserString&);
+ friend inline Units operator|(Units a, Units b)
+ {
+ return static_cast<Units>(static_cast<unsigned>(a) | static_cast<unsigned>(b));
+ }
+
+ static bool validUnit(CSSParserValue*, Units, bool strict);
+
+ PassRefPtr<CSSPrimitiveValue> createPrimitiveNumericValue(CSSParserValue*);
+ PassRefPtr<CSSPrimitiveValue> createPrimitiveStringValue(CSSParserValue*);
+
+ friend class TransformOperationInfo;
+};
+
+int cssPropertyID(const CSSParserString&);
+int cssPropertyID(const String&);
+int cssValueKeywordID(const CSSParserString&);
+
+class ShorthandScope {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ ShorthandScope(CSSParser* parser, int propId) : m_parser(parser)
+ {
+ if (!(m_parser->m_inParseShorthand++))
+ m_parser->m_currentShorthand = propId;
+ }
+ ~ShorthandScope()
+ {
+ if (!(--m_parser->m_inParseShorthand))
+ m_parser->m_currentShorthand = 0;
+ }
+
+private:
+ CSSParser* m_parser;
+};
+
+String quoteCSSString(const String&);
+String quoteCSSStringIfNeeded(const String&);
+String quoteCSSURLIfNeeded(const String&);
+
+bool isValidNthToken(const CSSParserString&);
} // namespace WebCore
#endif // CSSParser_h
diff --git a/third_party/WebKit/Source/WebCore/css/CSSPropertyNames.in b/third_party/WebKit/Source/WebCore/css/CSSPropertyNames.in
index 4a0cd6e..83bc0d7 100644
--- a/third_party/WebKit/Source/WebCore/css/CSSPropertyNames.in
+++ b/third_party/WebKit/Source/WebCore/css/CSSPropertyNames.in
@@ -58,6 +58,7 @@ border-bottom-style
border-bottom-width
border-collapse
border-color
+border-image-slice
border-image-source
border-left
border-left-color
@@ -279,6 +280,7 @@ z-index
-webkit-mask
-webkit-mask-attachment
-webkit-mask-box-image
+-webkit-mask-box-image-slice
-webkit-mask-box-image-source
-webkit-mask-clip
-webkit-mask-composite
diff --git a/third_party/WebKit/Source/WebCore/css/CSSStyleSelector.cpp b/third_party/WebKit/Source/WebCore/css/CSSStyleSelector.cpp
index e02165e..69a89f6 100644
--- a/third_party/WebKit/Source/WebCore/css/CSSStyleSelector.cpp
+++ b/third_party/WebKit/Source/WebCore/css/CSSStyleSelector.cpp
@@ -4328,6 +4328,24 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
m_style->setMaskBoxImage(image);
return;
}
+ case CSSPropertyBorderImageSlice:
+ case CSSPropertyWebkitMaskBoxImageSlice: {
+ bool isBorderImage = id == CSSPropertyBorderImageSlice;
+ NinePieceImage image(isBorderImage ? m_style->borderImage() : m_style->maskBoxImage());
+ if (isInherit)
+ image.copySlicesFrom(isBorderImage ? m_parentStyle->borderImage() : m_parentStyle->maskBoxImage());
+ else if (isInitial) {
+ image.setSlices(LengthBox(Length(100, Percent), Length(100, Percent), Length(100, Percent), Length(100, Percent)));
+ image.setFill(false);
+ } else
+ mapNinePieceImageSlice(value, image);
+
+ if (isBorderImage)
+ m_style->setBorderImage(image);
+ else
+ m_style->setMaskBoxImage(image);
+ return;
+ }
case CSSPropertyImageRendering:
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(imageRendering, ImageRendering);
return;
@@ -5671,26 +5689,7 @@ void CSSStyleSelector::mapNinePieceImage(CSSPropertyID property, CSSValue* value
imageProperty = property;
image.setImage(styleImage(imageProperty, borderImage->imageValue()));
- // Set up a length box to represent our image slices.
- LengthBox l;
- Rect* r = borderImage->m_imageSliceRect.get();
- if (r->top()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
- l.m_top = Length(r->top()->getDoubleValue(), Percent);
- else
- l.m_top = Length(r->top()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
- if (r->bottom()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
- l.m_bottom = Length(r->bottom()->getDoubleValue(), Percent);
- else
- l.m_bottom = Length((int)r->bottom()->getFloatValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
- if (r->left()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
- l.m_left = Length(r->left()->getDoubleValue(), Percent);
- else
- l.m_left = Length(r->left()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
- if (r->right()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
- l.m_right = Length(r->right()->getDoubleValue(), Percent);
- else
- l.m_right = Length(r->right()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
- image.setSlices(l);
+ mapNinePieceImageSlice(borderImage->m_slice.get(), image);
// Set the appropriate rules for stretch/round/repeat of the slices
ENinePieceImageRule horizontalRule;
@@ -5722,6 +5721,39 @@ void CSSStyleSelector::mapNinePieceImage(CSSPropertyID property, CSSValue* value
image.setVerticalRule(verticalRule);
}
+void CSSStyleSelector::mapNinePieceImageSlice(CSSValue* value, NinePieceImage& image)
+{
+ if (!value || !value->isBorderImageSliceValue())
+ return;
+
+ // Retrieve the border image value.
+ CSSBorderImageSliceValue* borderImageSlice = static_cast<CSSBorderImageSliceValue*>(value);
+
+ // Set up a length box to represent our image slices.
+ LengthBox box;
+ Rect* r = borderImageSlice->m_rect.get();
+ if (r->top()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
+ box.m_top = Length(r->top()->getDoubleValue(), Percent);
+ else
+ box.m_top = Length(r->top()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
+ if (r->bottom()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
+ box.m_bottom = Length(r->bottom()->getDoubleValue(), Percent);
+ else
+ box.m_bottom = Length((int)r->bottom()->getFloatValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
+ if (r->left()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
+ box.m_left = Length(r->left()->getDoubleValue(), Percent);
+ else
+ box.m_left = Length(r->left()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
+ if (r->right()->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE)
+ box.m_right = Length(r->right()->getDoubleValue(), Percent);
+ else
+ box.m_right = Length(r->right()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
+ image.setSlices(box);
+
+ // Set our fill mode.
+ image.setFill(borderImageSlice->m_fill);
+}
+
void CSSStyleSelector::checkForTextSizeAdjust()
{
if (m_style->textSizeAdjust())
@@ -6421,7 +6453,7 @@ void CSSStyleSelector::loadPendingImages()
const NinePieceImage& maskImage = reflection->mask();
if (maskImage.image() && maskImage.image()->isPendingImage()) {
CSSImageValue* imageValue = static_cast<StylePendingImage*>(maskImage.image())->cssImageValue();
- reflection->setMask(NinePieceImage(imageValue->cachedImage(cachedResourceLoader), maskImage.slices(), maskImage.horizontalRule(), maskImage.verticalRule()));
+ reflection->setMask(NinePieceImage(imageValue->cachedImage(cachedResourceLoader), maskImage.slices(), maskImage.fill(), maskImage.horizontalRule(), maskImage.verticalRule()));
}
}
break;
diff --git a/third_party/WebKit/Source/WebCore/css/CSSStyleSelector.h b/third_party/WebKit/Source/WebCore/css/CSSStyleSelector.h
index a965e46..0f67b37 100644
--- a/third_party/WebKit/Source/WebCore/css/CSSStyleSelector.h
+++ b/third_party/WebKit/Source/WebCore/css/CSSStyleSelector.h
@@ -330,7 +330,8 @@ public:
void mapAnimationTimingFunction(Animation*, CSSValue*);
void mapNinePieceImage(CSSPropertyID, CSSValue*, NinePieceImage&);
-
+ void mapNinePieceImageSlice(CSSValue*, NinePieceImage&);
+
bool canShareStyleWithControl(StyledElement*) const;
void applyProperty(int id, CSSValue*);
diff --git a/third_party/WebKit/Source/WebCore/css/CSSValue.h b/third_party/WebKit/Source/WebCore/css/CSSValue.h
index c535da2..ad0b63c 100644
--- a/third_party/WebKit/Source/WebCore/css/CSSValue.h
+++ b/third_party/WebKit/Source/WebCore/css/CSSValue.h
@@ -53,6 +53,7 @@ public:
virtual bool isMutableValue() const { return false; }
virtual bool isBorderImageValue() const { return false; }
+ virtual bool isBorderImageSliceValue() const { return false; }
virtual bool isCursorImageValue() const { return false; }
#if ENABLE(CSS3_FLEXBOX)
virtual bool isFlexValue() const { return false; }
diff --git a/third_party/WebKit/Source/WebCore/rendering/RenderBoxModelObject.cpp b/third_party/WebKit/Source/WebCore/rendering/RenderBoxModelObject.cpp
index 5f24804..aa1ce12 100644
--- a/third_party/WebKit/Source/WebCore/rendering/RenderBoxModelObject.cpp
+++ b/third_party/WebKit/Source/WebCore/rendering/RenderBoxModelObject.cpp
@@ -989,7 +989,7 @@ bool RenderBoxModelObject::paintNinePieceImage(GraphicsContext* graphicsContext,
bool drawTop = topSlice > 0 && topWidth > 0;
bool drawRight = rightSlice > 0 && rightWidth > 0;
bool drawBottom = bottomSlice > 0 && bottomWidth > 0;
- bool drawMiddle = (imageWidth - leftSlice - rightSlice) > 0 && (rect.width() - leftWidth - rightWidth) > 0
+ bool drawMiddle = ninePieceImage.fill() && (imageWidth - leftSlice - rightSlice) > 0 && (rect.width() - leftWidth - rightWidth) > 0
&& (imageHeight - topSlice - bottomSlice) > 0 && (rect.height() - topWidth - bottomWidth) > 0;
RefPtr<Image> image = styleImage->image(this, imageSize);
diff --git a/third_party/WebKit/Source/WebCore/rendering/style/NinePieceImage.cpp b/third_party/WebKit/Source/WebCore/rendering/style/NinePieceImage.cpp
index d585e8f..a86c95c 100644
--- a/third_party/WebKit/Source/WebCore/rendering/style/NinePieceImage.cpp
+++ b/third_party/WebKit/Source/WebCore/rendering/style/NinePieceImage.cpp
@@ -28,8 +28,8 @@ namespace WebCore {
bool NinePieceImage::operator==(const NinePieceImage& o) const
{
- return StyleImage::imagesEquivalent(m_image.get(), o.m_image.get()) && m_slices == o.m_slices && m_horizontalRule == o.m_horizontalRule &&
- m_verticalRule == o.m_verticalRule;
+ return StyleImage::imagesEquivalent(m_image.get(), o.m_image.get()) && m_slices == o.m_slices && m_fill == o.m_fill
+ && m_horizontalRule == o.m_horizontalRule && m_verticalRule == o.m_verticalRule;
}
}
diff --git a/third_party/WebKit/Source/WebCore/rendering/style/NinePieceImage.h b/third_party/WebKit/Source/WebCore/rendering/style/NinePieceImage.h
index 656dbd0..74710d1 100644
--- a/third_party/WebKit/Source/WebCore/rendering/style/NinePieceImage.h
+++ b/third_party/WebKit/Source/WebCore/rendering/style/NinePieceImage.h
@@ -37,14 +37,17 @@ class NinePieceImage {
public:
NinePieceImage()
: m_image(0)
+ , m_slices(Length(100, Percent), Length(100, Percent), Length(100, Percent), Length(100, Percent))
+ , m_fill(false)
, m_horizontalRule(StretchImageRule)
, m_verticalRule(StretchImageRule)
{
}
- NinePieceImage(StyleImage* image, LengthBox slices, ENinePieceImageRule h, ENinePieceImageRule v)
+ NinePieceImage(StyleImage* image, LengthBox slices, bool fill, ENinePieceImageRule h, ENinePieceImageRule v)
: m_image(image)
, m_slices(slices)
+ , m_fill(fill)
, m_horizontalRule(h)
, m_verticalRule(v)
{
@@ -60,17 +63,25 @@ public:
const LengthBox& slices() const { return m_slices; }
void setSlices(const LengthBox& l) { m_slices = l; }
+ bool fill() const { return m_fill; }
+ void setFill(bool fill) { m_fill = fill; }
+
ENinePieceImageRule horizontalRule() const { return static_cast<ENinePieceImageRule>(m_horizontalRule); }
void setHorizontalRule(ENinePieceImageRule rule) { m_horizontalRule = rule; }
ENinePieceImageRule verticalRule() const { return static_cast<ENinePieceImageRule>(m_verticalRule); }
void setVerticalRule(ENinePieceImageRule rule) { m_verticalRule = rule; }
-friend class RenderStyle;
+ void copySlicesFrom(const NinePieceImage& other)
+ {
+ m_slices = other.m_slices;
+ m_fill = other.m_fill;
+ }
private:
RefPtr<StyleImage> m_image;
LengthBox m_slices;
+ bool m_fill : 1;
unsigned m_horizontalRule : 2; // ENinePieceImageRule
unsigned m_verticalRule : 2; // ENinePieceImageRule
};