From 31041b24522260dee37afa13aa70404cb36d9e49 Mon Sep 17 00:00:00 2001 From: Joonas Lehtinen Date: Thu, 3 Jul 2008 14:59:51 +0000 Subject: [PATCH] Ensuring that caption styles do not leak in deep component trees. Connected to #1897 svn changeset:5037/svn branch:trunk --- .../default/orderedlayout/orderedlayout.css | 33 ++++--------------- WebContent/ITMILL/themes/default/styles.css | 33 ++++--------------- .../ITMILL/themes/tests-tickets/styles.css | 1 - .../gwt/client/ui/IOrderedLayout.java | 8 +++-- 4 files changed, 18 insertions(+), 57 deletions(-) diff --git a/WebContent/ITMILL/themes/default/orderedlayout/orderedlayout.css b/WebContent/ITMILL/themes/default/orderedlayout/orderedlayout.css index 635fe1a3bf..60832fd639 100644 --- a/WebContent/ITMILL/themes/default/orderedlayout/orderedlayout.css +++ b/WebContent/ITMILL/themes/default/orderedlayout/orderedlayout.css @@ -18,36 +18,15 @@ padding-left: 8px; } -.i-orderedlayout-w2 .i-caption * { - float:left; - display: block; -} -.i-orderedlayout-w-e { - float:left; -} - -.i-orderedlayout-w2 .i-caption:after, .i-orderedlayout-w2:after { +/* Placing error indicator right after the widget with empty caption */ +.i-orderedlayout-w:after, .i-orderedlayout-c:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } - -.i-orderedlayout-w2 .i-caption, .i-orderedlayout-w2 { - display: inline-block; -} - -/* Hides from IE-mac \*/ -* html .i-orderedlayout-w2 .i-caption, * html .i-orderedlayout-w2 { height: 1%; } -.i-orderedlayout-w2 .i-caption, .i-orderedlayout-w2 { display: block; } -/* End hide from IE-mac */ - -/* -.i-errorindicator { - background:transparent url(../icons/16/error.png) no-repeat scroll right top; - height:16px; - width:10px; - margin-left: 3px; -} -*/ \ No newline at end of file +.i-orderedlayout-c * { float:left; display: block;} +.i-orderedlayout-w-e { float:left;} +* html .i-orderedlayout-c, * html .i-orderedlayout-w { height: 1%; } +.i-orderedlayout-c, .i-orderedlayout-w { display: block; } \ No newline at end of file diff --git a/WebContent/ITMILL/themes/default/styles.css b/WebContent/ITMILL/themes/default/styles.css index f66b4bd465..ce0a2657d3 100644 --- a/WebContent/ITMILL/themes/default/styles.css +++ b/WebContent/ITMILL/themes/default/styles.css @@ -717,39 +717,18 @@ input.i-modified, padding-left: 8px; } -.i-orderedlayout-w2 .i-caption * { - float:left; - display: block; -} -.i-orderedlayout-w-e { - float:left; -} - -.i-orderedlayout-w2 .i-caption:after, .i-orderedlayout-w2:after { +/* Placing error indicator right after the widget with empty caption */ +.i-orderedlayout-w:after, .i-orderedlayout-c:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } - -.i-orderedlayout-w2 .i-caption, .i-orderedlayout-w2 { - display: inline-block; -} - -/* Hides from IE-mac \*/ -* html .i-orderedlayout-w2 .i-caption, * html .i-orderedlayout-w2 { height: 1%; } -.i-orderedlayout-w2 .i-caption, .i-orderedlayout-w2 { display: block; } -/* End hide from IE-mac */ - -/* -.i-errorindicator { - background:transparent url(icons/16/error.png) no-repeat scroll right top; - height:16px; - width:10px; - margin-left: 3px; -} -*/ +.i-orderedlayout-c * { float:left; display: block;} +.i-orderedlayout-w-e { float:left;} +* html .i-orderedlayout-c, * html .i-orderedlayout-w { height: 1%; } +.i-orderedlayout-c, .i-orderedlayout-w { display: block; } .i-panel, .i-panel-caption, .i-panel-content, diff --git a/WebContent/ITMILL/themes/tests-tickets/styles.css b/WebContent/ITMILL/themes/tests-tickets/styles.css index 7f558c42b8..f7d190e226 100644 --- a/WebContent/ITMILL/themes/tests-tickets/styles.css +++ b/WebContent/ITMILL/themes/tests-tickets/styles.css @@ -17,7 +17,6 @@ background-color: #eee; } - /*****************************************************************************/ /* Ticket 1857 */ /*****************************************************************************/ diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IOrderedLayout.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IOrderedLayout.java index d0d8cb5f1f..c4e1f175ea 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IOrderedLayout.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IOrderedLayout.java @@ -290,7 +290,8 @@ public abstract class IOrderedLayout extends Panel implements Container { if (after) { DOM.appendChild(getElement(), captionElement); DOM.setElementAttribute(getElement(), "class", - "i-orderedlayout-w2"); + "i-orderedlayout-w"); + caption.addStyleName("i-orderedlayout-c"); widget.addStyleName("i-orderedlayout-w-e"); } else { DOM.insertChild(getElement(), captionElement, 0); @@ -305,11 +306,13 @@ public abstract class IOrderedLayout extends Panel implements Container { DOM.removeChild(getElement(), firstElement); DOM.appendChild(getElement(), firstElement); DOM.setElementAttribute(getElement(), "class", - after ? "i-orderedlayout-w2" : ""); + after ? "i-orderedlayout-w" : ""); if (after) { + caption.addStyleName("i-orderedlayout-c"); widget.addStyleName("i-orderedlayout-w-e"); } else { widget.removeStyleName("i-orderedlayout-w-e"); + caption.removeStyleName("i-orderedlayout-w-c"); } } @@ -319,6 +322,7 @@ public abstract class IOrderedLayout extends Panel implements Container { caption = null; DOM.setElementAttribute(getElement(), "class", ""); widget.removeStyleName("i-orderedlayout-w-e"); + caption.removeStyleName("i-orderedlayout-w-c"); } } } -- 2.39.5