Skip to content

Scrollbar 1 #318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions org/w3c/css/properties/CSS3Properties.properties
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ scroll-margin-top: org.w3c.css.properties.css3.CssScrollMar
scroll-snap-stop: org.w3c.css.properties.css3.CssScrollSnapStop
scroll-snap-type: org.w3c.css.properties.css3.CssScrollSnapType

#scrollbar
scrollbar-color: org.w3c.css.properties.css3.CssScrollbarColor
scrollbar-width: org.w3c.css.properties.css3.CssScrollbarWidth

# grid
grid: org.w3c.css.properties.css3.CssGrid
grid-area: org.w3c.css.properties.css3.CssGridArea
Expand Down
115 changes: 115 additions & 0 deletions org/w3c/css/properties/css/CssScrollbarColor.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
//
// Author: Yves Lafon <ylafon@w3.org>
//
// (c) COPYRIGHT MIT, ERCIM, Keio, Beihang, 2021.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.properties.css;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css3.Css3Style;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssValue;

/**
* @since CSS3
*/
public class CssScrollbarColor extends CssProperty {

public CssValue value;

/**
* Create a new CssScrollbarColor
*/
public CssScrollbarColor() {
}

/**
* Creates a new CssScrollbarColor
*
* @param expression The expression for this property
* @throws InvalidParamException
* Expressions are incorrect
*/
public CssScrollbarColor(ApplContext ac, CssExpression expression, //
boolean check) throws InvalidParamException {
throw new InvalidParamException("value",
expression.getValue().toString(),
getPropertyName(), ac);
}

public CssScrollbarColor(ApplContext ac, CssExpression expression)
throws InvalidParamException {
this(ac, expression, false);
}

/**
* Returns the value of this property
*/
public Object get() {
return value;
}


/**
* Returns the name of this property
*/
public final String getPropertyName() {
return "scrollbar-color";
}

/**
* Returns true if this property is "softly" inherited
* e.g. his value is equals to inherit
*/
public boolean isSoftlyInherited() {
return value.equals(inherit);
}

/**
* Returns a string representation of the object.
*/
public String toString() {
return value.toString();
}

/**
* Add this property to the CssStyle.
*
* @param style The CssStyle
*/
public void addToStyle(ApplContext ac, CssStyle style) {
Css3Style s = (Css3Style) style;
if (s.cssScrollbarColor != null) {
style.addRedefinitionWarning(ac, this);
}
s.cssScrollbarColor = this;
}


/**
* Compares two properties for equality.
*
* @param property The other property.
*/
public boolean equals(CssProperty property) {
return (property instanceof CssScrollbarColor &&
value.equals(((CssScrollbarColor) property).value));
}


/**
* Get this property in the style.
*
* @param style The style where the property is
* @param resolve if true, resolve the style to find this property
*/
public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
if (resolve) {
return ((Css3Style) style).getScrollbarColor();
} else {
return ((Css3Style) style).cssScrollbarColor;
}
}
}
115 changes: 115 additions & 0 deletions org/w3c/css/properties/css/CssScrollbarWidth.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
//
// Author: Yves Lafon <ylafon@w3.org>
//
// (c) COPYRIGHT MIT, ERCIM, Keio, Beihang, 2021.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.properties.css;

import org.w3c.css.parser.CssStyle;
import org.w3c.css.properties.css3.Css3Style;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssValue;

/**
* @since CSS3
*/
public class CssScrollbarWidth extends CssProperty {

public CssValue value;

/**
* Create a new CssScrollbarWidth
*/
public CssScrollbarWidth() {
}

/**
* Creates a new CssScrollbarWidth
*
* @param expression The expression for this property
* @throws InvalidParamException
* Expressions are incorrect
*/
public CssScrollbarWidth(ApplContext ac, CssExpression expression, //
boolean check) throws InvalidParamException {
throw new InvalidParamException("value",
expression.getValue().toString(),
getPropertyName(), ac);
}

public CssScrollbarWidth(ApplContext ac, CssExpression expression)
throws InvalidParamException {
this(ac, expression, false);
}

/**
* Returns the value of this property
*/
public Object get() {
return value;
}


/**
* Returns the name of this property
*/
public final String getPropertyName() {
return "scrollbar-width";
}

/**
* Returns true if this property is "softly" inherited
* e.g. his value is equals to inherit
*/
public boolean isSoftlyInherited() {
return value.equals(inherit);
}

/**
* Returns a string representation of the object.
*/
public String toString() {
return value.toString();
}

/**
* Add this property to the CssStyle.
*
* @param style The CssStyle
*/
public void addToStyle(ApplContext ac, CssStyle style) {
Css3Style s = (Css3Style) style;
if (s.cssScrollbarWidth != null) {
style.addRedefinitionWarning(ac, this);
}
s.cssScrollbarWidth = this;
}


/**
* Compares two properties for equality.
*
* @param property The other property.
*/
public boolean equals(CssProperty property) {
return (property instanceof CssScrollbarWidth &&
value.equals(((CssScrollbarWidth) property).value));
}


/**
* Get this property in the style.
*
* @param style The style where the property is
* @param resolve if true, resolve the style to find this property
*/
public CssProperty getPropertyInStyle(CssStyle style, boolean resolve) {
if (resolve) {
return ((Css3Style) style).getScrollbarWidth();
} else {
return ((Css3Style) style).cssScrollbarWidth;
}
}
}
22 changes: 22 additions & 0 deletions org/w3c/css/properties/css3/Css3Style.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@
import org.w3c.css.properties.css.CssScrollSnapAlign;
import org.w3c.css.properties.css.CssScrollSnapStop;
import org.w3c.css.properties.css.CssScrollSnapType;
import org.w3c.css.properties.css.CssScrollbarColor;
import org.w3c.css.properties.css.CssScrollbarWidth;
import org.w3c.css.properties.css.CssSpeakAs;
import org.w3c.css.properties.css.CssTabSize;
import org.w3c.css.properties.css.CssTextAlignAll;
Expand Down Expand Up @@ -623,7 +625,27 @@ public class Css3Style extends ATSCStyle {
public CssTextDecorationSkipInset cssTextDecorationSkipInset;
public CssTextDecorationSkipInk cssTextDecorationSkipInk;
public CssTextDecorationSkipSpaces cssTextDecorationSkipSpaces;
public CssScrollbarWidth cssScrollbarWidth;
public CssScrollbarColor cssScrollbarColor;

public CssScrollbarColor getScrollbarColor() {
if (cssScrollbarColor == null) {
cssScrollbarColor =
(CssScrollbarColor) style.CascadingOrder(new CssScrollbarColor(),
style, selector);
}
return cssScrollbarColor;
}

public CssScrollbarWidth getScrollbarWidth() {
if (cssScrollbarWidth == null) {
cssScrollbarWidth =
(CssScrollbarWidth) style.CascadingOrder(new CssScrollbarWidth(),
style, selector);
}
return cssScrollbarWidth;
}

public CssTextDecorationSkipSpaces getTextDecorationSkipSpaces() {
if (cssTextDecorationSkipSpaces == null) {
cssTextDecorationSkipSpaces =
Expand Down
Loading