Skip to content

Commit 004d1e4

Browse files
author
Koen Deforche
committed
allow IE8=IE7 rendering to return with a configuration option
1 parent 4c497e5 commit 004d1e4

File tree

14 files changed

+144
-75
lines changed

14 files changed

+144
-75
lines changed

examples/widgetgallery/approot/wt_config.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
<web-sockets>false</web-sockets>
44
<progressive-bootstrap>false</progressive-bootstrap>
55
<log-config>* -debug -info:WebRequest</log-config>
6+
<UA-Compatible>IE8=IE7</UA-Compatible>
67
</application-settings>
78
</server>

resources/themes/bootstrap/wt.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,13 @@
7575
/*
7676
* Custom collapse nav support
7777
*/
78-
.nav-bar .nav-collapse {
78+
.navbar .nav-collapse {
7979
display: block !important;
8080
}
81+
.navbar .navbar-inner .container {
82+
margin-left: 0px;
83+
margin-right: 0px;
84+
}
8185
/*
8286
* Less odd drop down menu support in navbar
8387
*/

resources/themes/bootstrap/wt.less

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,24 @@
6161
/*
6262
* Custom collapse nav support
6363
*/
64-
.nav-bar .nav-collapse {
65-
display: block !important;
64+
.navbar .nav-collapse {
65+
display: block !important;
66+
}
67+
68+
.navbar .navbar-inner .container {
69+
margin-left: 0px;
70+
margin-right: 0px;
6671
}
6772

6873
/*
6974
* Less odd drop down menu support in navbar
7075
*/
7176
.navbar .nav > li.submenu > a:hover,
7277
.navbar .nav > li.submenu > a.active {
73-
color: @navbarLinkColorActive;
74-
text-decoration: none;
75-
background-color: @navbarLinkBackgroundActive;
76-
.box-shadow(inset 0 3px 8px rgba(0,0,0,.125));
78+
color: @navbarLinkColorActive;
79+
text-decoration: none;
80+
background-color: @navbarLinkBackgroundActive;
81+
.box-shadow(inset 0 3px 8px rgba(0,0,0,.125));
7782
}
7883

7984
/*

src/Wt/WApplication.C

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,17 @@ WApplication::WApplication(const WEnvironment& env
140140
setLocalizedStrings(0);
141141
#endif // !WT_TARGET_JAVA
142142

143-
if (environment().agentIsIE() &&
144-
environment().agent() >= WEnvironment::IE9)
145-
addMetaHeader(MetaHttpHeader, "X-UA-Compatible", "IE=9");
143+
if (environment().agentIsIE()) {
144+
if (environment().agent() < WEnvironment::IE9) {
145+
const Configuration& conf = environment().server()->configuration();
146+
bool selectIE7 = conf.uaCompatible().find("IE8=IE7")
147+
!= std::string::npos;
148+
149+
if (selectIE7)
150+
addMetaHeader(MetaHttpHeader, "X-UA-Compatible", "IE=7");
151+
} else
152+
addMetaHeader(MetaHttpHeader, "X-UA-Compatible", "IE=9");
153+
}
146154

147155
domRoot_ = new WContainerWidget();
148156
domRoot_->setStyleClass("Wt-domRoot");

src/Wt/WMenu

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ protected:
639639

640640
virtual void renderSelected(WMenuItem *item, bool selected);
641641

642-
virtual void select(int index, bool changePath);
642+
virtual void setCurrent(int index);
643643

644644
private:
645645
WContainerWidget *ul_;
@@ -666,6 +666,7 @@ private:
666666
void undoSelectVisual();
667667
void selectVisual(int item, bool changePath, bool showContents);
668668
void onItemHidden(int index, bool hidden);
669+
void select(int index, bool changePath);
669670

670671
friend class WMenuItem;
671672

src/Wt/WMenu.C

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ void WMenu::addItem(WMenuItem *item)
218218
contentsStack_->addWidget(contents);
219219

220220
if (contentsStack_->count() == 1) {
221-
current_ = 0;
221+
setCurrent(0);
222+
222223
if (contents)
223224
contentsStack_->setCurrentWidget(contents);
224225

@@ -267,28 +268,33 @@ void WMenu::select(int index)
267268
select(index, true);
268269
}
269270

271+
void WMenu::setCurrent(int index)
272+
{
273+
current_ = index;
274+
}
275+
270276
void WMenu::select(int index, bool changePath)
271277
{
272278
int last = current_;
273-
current_ = index;
279+
setCurrent(index);
274280

275-
selectVisual(index, changePath, true);
281+
selectVisual(current_, changePath, true);
276282

277283
if (index != -1) {
278284
WMenuItem *item = itemAt(index);
279285
item->show();
280286
item->loadContents();
281287

282-
if (last != index) {
283-
item->triggered().emit(item);
284-
itemSelected_.emit(item);
285-
}
286-
287288
if (changePath && emitPathChange_) {
288289
WApplication *app = wApp;
289290
app->internalPathChanged().emit(app->internalPath());
290291
emitPathChange_ = false;
291292
}
293+
294+
if (last != index) {
295+
item->triggered().emit(item);
296+
itemSelected_.emit(item);
297+
}
292298
}
293299
}
294300

src/Wt/WPainter

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,19 +290,19 @@ public:
290290
* Create an image which is located at the <i>uri</i>, and which has
291291
* dimensions <i>width</i> x <i>height</i>.
292292
*/
293-
Image(const std::string& uri, int width, int height);
293+
Image(const std::string& url, int width, int height);
294294

295295
/*! \brief Creates an image.
296296
*
297297
* Create an image which is located at <i>uri</i> which is available on
298298
* the local filesystem as <i>file</i>. The image dimensions are
299299
* retrieved from the file.
300300
*/
301-
Image(const std::string& uri, const std::string& file);
301+
Image(const std::string& url, const std::string& file);
302302

303-
/*! \brief Returns the uri.
303+
/*! \brief Returns the url.
304304
*/
305-
std::string uri() const { return uri_; }
305+
std::string uri() const { return url_; }
306306

307307
/*! \brief Returns the image width.
308308
*/
@@ -313,8 +313,10 @@ public:
313313
int height() const { return height_; }
314314

315315
private:
316-
std::string uri_;
316+
std::string url_;
317317
int width_, height_;
318+
319+
void setUrl(const std::string& url);
318320
};
319321

320322
/*! \brief Draws an image.

src/Wt/WPainter.C

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "Wt/Render/WTextRenderer"
1414
#endif
1515

16+
#include "Wt/WApplication"
1617
#include "Wt/WException"
1718
#include "Wt/WLineF"
1819
#include "Wt/WPainter"
@@ -104,15 +105,26 @@ WPainter::State WPainter::State::clone()
104105
}
105106
#endif // WT_TARGET_JAVA
106107

107-
WPainter::Image::Image(const std::string& uri, int width, int height)
108-
: uri_(uri),
109-
width_(width),
108+
WPainter::Image::Image(const std::string& url, int width, int height)
109+
: width_(width),
110110
height_(height)
111-
{ }
111+
{
112+
setUrl(url);
113+
}
112114

113-
WPainter::Image::Image(const std::string& uri, const std::string& fileName)
114-
: uri_(uri)
115+
void WPainter::Image::setUrl(const std::string& url)
115116
{
117+
WApplication *app = WApplication::instance();
118+
if (app)
119+
url_ = app->resolveRelativeUrl(url);
120+
else
121+
url_ = url;
122+
}
123+
124+
WPainter::Image::Image(const std::string& url, const std::string& fileName)
125+
{
126+
setUrl(url);
127+
116128
/*
117129
* Contributed by Daniel Derr @ ArrowHead Electronics Health-Care
118130
*/

src/Wt/WPopupMenu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ protected:
234234
virtual bool isExposed(WWidget *widget);
235235

236236
virtual void renderSelected(WMenuItem *item, bool selected);
237-
virtual void select(int index, bool changePath);
237+
virtual void setCurrent(int index);
238238

239239
private:
240240
WMenuItem *result_;

src/Wt/WPopupMenu.C

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,6 @@ void WPopupMenu::popupAtButton()
5959
popup(button_);
6060
}
6161

62-
void WPopupMenu::select(int index, bool changePath)
63-
{
64-
WMenu::select(index, changePath);
65-
WMenu::select(-1, false);
66-
}
67-
6862
void WPopupMenu::setMaximumSize(const WLength& width,
6963
const WLength& height)
7064
{
@@ -183,6 +177,11 @@ void WPopupMenu::prepareRender(WApplication *app)
183177
adjustPadding();
184178
}
185179

180+
void WPopupMenu::setCurrent(int index)
181+
{
182+
// a popup menu does not have a 'current' item.
183+
}
184+
186185
void WPopupMenu::connectSignals(WPopupMenu * const topLevel)
187186
{
188187
itemSelected().connect(topLevel, &WPopupMenu::done);

0 commit comments

Comments
 (0)