Skip to content

Commit

Permalink
[NETBEANS-2005] Add definitions from CSS Box Alignment module
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasblaesing committed Dec 8, 2021
1 parent d5149f3 commit edfbf59
Show file tree
Hide file tree
Showing 11 changed files with 113 additions and 35 deletions.
2 changes: 1 addition & 1 deletion ide/css.editor/external/binaries-list
Expand Up @@ -15,4 +15,4 @@
# specific language governing permissions and limitations
# under the License.
901D8F815922C435D985DA3814D20E34CC7622CB css21-spec.zip
123E52BDC74F5DC90F99C8C2B0993D678D60AE81 css3-spec.zip
28CA342F4D9FDC96C234E60E0B8E2058A6B5F0EE css3-spec.zip
3 changes: 2 additions & 1 deletion ide/css.editor/external/css3-spec-howtocreate.txt
Expand Up @@ -49,7 +49,8 @@ http://www.w3.org/TR/css3-text/ \
http://www.w3.org/TR/css3-transitions/ \
http://www.w3.org/TR/css3-ui/ \
http://www.w3.org/TR/css3-values/ \
http://www.w3.org/TR/css3-writing-modes/
http://www.w3.org/TR/css3-writing-modes/ \
http://www.w3.org/TR/css-align-3/

3. Check that the contents still looks sane and mirroring worked

Expand Down
Expand Up @@ -51,7 +51,7 @@ css-module-displayname-presentation_levels=Presentation Levels
css-module-displayname-generated_and_replaced_content=Generated and Replaced Content
css-module-displayname-lists_and_counters=List and Counters
css-module-displayname-paged_media=Paged Media

css-module-displayname-alignment=Box Alignment


completion-help-no-documentation-found=No documentation found
Expand Down
Expand Up @@ -102,7 +102,8 @@ public class DefaultCssEditorModule extends CssEditorModule {
module("line", "http://www.w3.org/TR/css3-linebox"),
module("hyperlinks", "http://www.w3.org/TR/css3-hyperlinks"),
module("presentation_levels", "http://www.w3.org/TR/css3-preslev"),
module("generated_and_replaced_content", "http://www.w3.org/TR/css3-content") //NOI18N
module("generated_and_replaced_content", "http://www.w3.org/TR/css3-content"), //NOI18N
module("alignment", "http://www.w3.org/TR/css-align-3")
};
private static Map<String, PropertyDefinition> propertyDescriptors;

Expand Down
@@ -0,0 +1,55 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# CSS Box Alignment Module

$category=alignment

column-gap = normal | <length-percentage>

row-gap = normal | <length-percentage>

gap = <row-gap> <column-gap>?

@content-distribution = space-between | space-around | space-evenly | stretch | <var-fn>

@overflow-position = unsafe | safe | <var-fn>

@content-position = center | start | end | flex-start | flex-end | <var-fn>

@baseline-position = [ [ first | last ]? baseline ] | <var-fn>

@self-position = center | start | end | self-start | self-end | flex-start | flex-end | <var-fn>

justify-items = normal | stretch | <baseline-position> | [ <overflow-position>? [ <self-position> | left | right ] ] | legacy | [ legacy && [ left | right | center ] ]

justify-self = auto | normal | stretch | <baseline-position> | [ <overflow-position>? [ <self-position> | left | right ] ]

align-content = normal | <baseline-position> | <content-distribution> | [ <overflow-position>? <content-position> ]

justify-content = normal | <content-distribution> | [ <overflow-position>? [ <content-position> | left | right ]]

place-content = <align-content> <justify-content>?

align-items = normal | stretch | <baseline-position> | [ <overflow-position>? <content-position> ]

place-items = <align-items> <justify-items>?

align-self = auto | normal | stretch | <baseline-position> | [ <overflow-position>? <self-position> ]

place-self = [ <align-self> <justify-self>? ] | <var-fn>

Expand Up @@ -17,8 +17,6 @@

#Flexible Box Layout Module

#display=flexbox | inline-flexbox

$category=flexible_box_layout

flex-direction=row | row-reverse | column | column-reverse | <var-fn>
Expand All @@ -36,11 +34,3 @@ flex-grow=<number>
flex-shrink= <number>

flex-basis=content | <width>

justify-content=flex-start | flex-end | center | space-between | space-around | <var-fn>

align-items=flex-start | flex-end | center | baseline | stretch | <var-fn>

align-self=auto | flex-start | flex-end | center | baseline | stretch | <var-fn>

align-content=flex-start | flex-end | center | space-between | space-around | stretch | <var-fn>
Expand Up @@ -31,8 +31,6 @@ column-count=<integer> | auto

column-fill=auto | balance | <var-fn>

column-gap= <length> | normal

column-rule=<column-rule-width> || <column-rule-style> || [ <column-rule-color> | transparent ]

column-rule-color=<color>
Expand Down
@@ -0,0 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.netbeans.modules.css.editor.module.main;

import org.netbeans.modules.parsing.spi.ParseException;

public class AlignmentModuleTest extends CssModuleTestBase {

public AlignmentModuleTest(String name) {
super(name);
}

public void testProperties() throws ParseException {
assertPropertyValues("align-items", "inherit", "safe flex-start");
assertPropertyValues("align-self", "inherit", "stretch", "first baseline");
assertPropertyValues("align-content", "inherit", "stretch", "safe end");
assertPropertyValues("justify-content", "inherit", "space-around", "safe right");
assertPropertyValues("justify-items", "inherit", "right legacy", "legacy right", "legacy", "safe self-start");
assertPropertyValues("justify-self", "initial", "baseline", "safe end");
assertPropertyValues("place-content", "space-around stretch", "safe start safe end");
assertPropertyValues("place-items", "unset", "safe flex-start stretch");
assertPropertyValues("place-self", "initial", "var(--test)", "first baseline safe right");
assertPropertyValues("row-gap", "initial", "20%", "30px", "var(--test)", "normal");
assertPropertyValues("column-gap", "initial", "20%", "30px", "var(--test)", "normal");
assertPropertyValues("gap", "initial", "20% 30px", "30px 20%", "var(--test)", "normal", "20px normal", "var(--test) 10px");
}

}
Expand Up @@ -35,6 +35,7 @@ public void testProperties() {
assertPropertyValues("flex-direction", "column");
assertPropertyValues("flex-wrap", "nowrap");
assertPropertyValues("align-content", "flex-start");
assertPropertyValues("flex-flow", "var(--test)");
}

}
Expand Up @@ -32,27 +32,14 @@ public MultiColumnLayoutTest(String name) {

public void testProperties() throws ParseException {
assertPropertyValues("break-after", "always");

assertPropertyValues("column-gap", "10px", "normal");

assertPropertyValues("column-rule", "10px", "10px red");

assertPropertyValues("column-rule-style", "ridge ridge inset outset");


//PropertyValue bug:
//columns=<column-width> || <column-count>
//column-width=auto | !length
//column-count=auto | !integer
//
//in this case any of the list members can be resolved, at least one I believe
//
//the problem: for input "auto 12em" the auto is resolved as a member of the column-width so
//the next alternative fails. This needs to be changed so the variables resolver tries all combinations
//of the alternatives before it says "no alternative".


// assertPropertyValues("columns", "auto auto", "auto 12em", "2 auto");

assertPropertyValues("columns", "auto auto", "auto 12em", "2 auto");
}

}
Expand Up @@ -37,6 +37,7 @@
//TODO defined the displaynames and descriptions
public enum PropertyCategory {

ALIGNMENT,
ANIMATIONS,
BOX,
BACKGROUND,
Expand Down

0 comments on commit edfbf59

Please sign in to comment.