Skip to content
Open
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
1 change: 1 addition & 0 deletions bundles/org.eclipse.e4.ui.css.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Export-Package: org.eclipse.e4.ui.css.core;x-internal:=true,
org.eclipse.e4.ui.css.core.impl.dom.parsers;x-internal:=true,
org.eclipse.e4.ui.css.core.impl.dom.properties;x-friends:="org.eclipse.e4.ui.css.swt",
org.eclipse.e4.ui.css.core.impl.engine;x-friends:="org.eclipse.e4.ui.css.swt,org.eclipse.e4.ui.workbench.swt",
org.eclipse.e4.ui.css.core.impl.engine.selector;x-friends:="org.eclipse.e4.ui.tests.css.core",
org.eclipse.e4.ui.css.core.impl.sac;x-internal:=true,
org.eclipse.e4.ui.css.core.resources;x-friends:="org.eclipse.e4.ui.css.swt,org.eclipse.e4.ui.workbench.renderers.swt",
org.eclipse.e4.ui.css.core.sac;x-internal:=true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2013 Angelo Zerr and others.
* Copyright (c) 2008, 2026 Angelo Zerr and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -13,8 +13,7 @@
*******************************************************************************/
package org.eclipse.e4.ui.css.core.dom;

import org.w3c.css.sac.Selector;
import org.w3c.css.sac.SelectorList;
import org.eclipse.e4.ui.css.core.impl.engine.selector.Selectors;
import org.w3c.dom.css.CSSRule;

/**
Expand All @@ -28,7 +27,7 @@ public interface ExtendedCSSRule extends CSSRule {
public CSSPropertyList getCSSPropertyList();

/**
* Return the list of {@link Selector} of this {@link CSSRule}.
* Return the list of selectors of this {@link CSSRule}.
*/
public SelectorList getSelectorList();
public Selectors.SelectorList getSelectorList();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2018 Angelo Zerr and others.
* Copyright (c) 2008, 2026 Angelo Zerr and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -15,9 +15,6 @@
package org.eclipse.e4.ui.css.core.dom;

import java.util.EventListener;
import java.util.List;
import org.w3c.css.sac.Condition;
import org.w3c.css.sac.Selector;
import org.w3c.dom.css.DocumentCSS;
import org.w3c.dom.stylesheets.StyleSheet;

Expand All @@ -26,21 +23,10 @@
*/
public interface ExtendedDocumentCSS extends DocumentCSS {

public static final Integer SAC_ID_CONDITION = Integer.valueOf(Condition.SAC_ID_CONDITION);
public static final Integer SAC_CLASS_CONDITION = Integer.valueOf(Condition.SAC_CLASS_CONDITION);
public static final Integer SAC_PSEUDO_CLASS_CONDITION = Integer.valueOf(Condition.SAC_PSEUDO_CLASS_CONDITION);
public static final Integer OTHER_SAC_CONDITIONAL_SELECTOR = Integer.valueOf(Selector.SAC_CONDITIONAL_SELECTOR);

public static final Integer OTHER_SAC_SELECTOR = Integer.valueOf(999);

public void addStyleSheet(StyleSheet styleSheet);

public void removeAllStyleSheets();

public List<?> queryConditionSelector(int conditionType);

public List<?> querySelector(int selectorType, int conditionType);

/**
* @since 0.12.200
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,23 @@ public default String retrieveCSSProperty(Object element, String property, Strin
return null;
}

/**
* Callback method called once after all CSS properties of a single
* declaration have been applied. Handlers that need to perform a final
* step (re-layout, redraw, batched commit, ...) override this method;
* the default is a no-op.
*/
default void onAllCSSPropertiesApplied(Object element, CSSEngine engine) throws Exception {
// do nothing
}

/**
* Variant of {@link #onAllCSSPropertiesApplied(Object, CSSEngine)} that
* also receives the pseudo class. Defaults to delegating to the
* pseudo-less form.
*/
default void onAllCSSPropertiesApplied(Object element, CSSEngine engine, String pseudo) throws Exception {
onAllCSSPropertiesApplied(element, engine);
}

}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
import org.eclipse.e4.ui.css.core.dom.IElementProvider;
import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler;
import org.eclipse.e4.ui.css.core.dom.properties.converters.ICSSValueConverter;
import org.eclipse.e4.ui.css.core.impl.engine.selector.Selectors;
import org.eclipse.e4.ui.css.core.resources.IResourcesRegistry;
import org.eclipse.e4.ui.css.core.util.resources.IResourcesLocatorManager;
import org.w3c.css.sac.InputSource;
import org.w3c.css.sac.Selector;
import org.w3c.css.sac.SelectorList;
import org.w3c.dom.Element;
import org.w3c.dom.css.CSSStyleDeclaration;
import org.w3c.dom.css.CSSStyleSheet;
Expand Down Expand Up @@ -105,27 +104,27 @@ public interface CSSEngine {
/**
* Parse Selectors from String value.
*/
SelectorList parseSelectors(String text);
Selectors.SelectorList parseSelectors(String text);

/**
* Parse Selectors from InputSource value.
*/
SelectorList parseSelectors(InputSource source) throws IOException;
Selectors.SelectorList parseSelectors(InputSource source) throws IOException;

/**
* Parse Selectors from InputStream.
*/
SelectorList parseSelectors(InputStream stream) throws IOException;
Selectors.SelectorList parseSelectors(InputStream stream) throws IOException;

/**
* Parse Selectors from String value.
*/
SelectorList parseSelectors(Reader reader) throws IOException;
Selectors.SelectorList parseSelectors(Reader reader) throws IOException;

/**
* Check if the <code>selector</code> matches the object <code>node</code>.
*/
boolean matches(Selector selector, Object node, String pseudo);
boolean matches(Selectors.Selector selector, Object node, String pseudo);

/*--------------- Apply styles -----------------*/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008, 2015 Angelo Zerr and others.
* Copyright (c) 2008, 2026 Angelo Zerr and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -17,8 +17,7 @@

import org.eclipse.e4.ui.css.core.dom.CSSPropertyList;
import org.eclipse.e4.ui.css.core.dom.ExtendedCSSRule;
import org.w3c.css.sac.Selector;
import org.w3c.css.sac.SelectorList;
import org.eclipse.e4.ui.css.core.impl.engine.selector.Selectors;
import org.w3c.dom.DOMException;
import org.w3c.dom.css.CSSRule;
import org.w3c.dom.css.CSSStyleDeclaration;
Expand All @@ -27,10 +26,10 @@

public class CSSStyleRuleImpl extends CSSRuleImpl implements CSSStyleRule, ExtendedCSSRule {

private final SelectorList selectors;
private final Selectors.SelectorList selectors;
private CSSStyleDeclaration styleDeclaration;

public CSSStyleRuleImpl(CSSStyleSheet parentStyleSheet, CSSRule parentRule, SelectorList selectors) {
public CSSStyleRuleImpl(CSSStyleSheet parentStyleSheet, CSSRule parentRule, Selectors.SelectorList selectors) {
super(parentStyleSheet, parentRule);
this.selectors = selectors;
}
Expand All @@ -55,17 +54,7 @@ public String getCssText() {

@Override
public String getSelectorText() {
StringBuilder sb = new StringBuilder();
for (int selID = 0; selID < getSelectorList().getLength(); selID++) {
Selector item = getSelectorList().item(selID);
sb.append(item.toString());
sb.append(", ");
}
if (getSelectorList().getLength() > 0) {
sb.delete(sb.length() - 2, sb.length());
}

return sb.toString();
return selectors.text();
}

@Override
Expand All @@ -83,7 +72,7 @@ public void setSelectorText(String selectorText) throws DOMException {
// Additional methods

@Override
public SelectorList getSelectorList() {
public Selectors.SelectorList getSelectorList() {
return selectors;
}

Expand Down
Loading
Loading