Skip to content

Commit 2d4882f

Browse files
author
Koen Deforche
committed
A batch of fixes and small improvements:
fix layout regression causing WDialog::show() not to work properly WPanel: also take into account maximum panel height remove the xhtml mime-type option, viva HTML5 be robust when modal dialogs are not being created and destroyed as a stack (#1512, #2005)
1 parent a20ef3f commit 2d4882f

21 files changed

+244
-224
lines changed

src/Wt/Test/WTestEnvironment

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,9 @@ public:
239239
*/
240240
void setInternalPath(const std::string& internalPath);
241241

242-
/*! \brief Sets the content type.
242+
/*! \brief Sets the content type (<b>deprecated</b>.
243243
*
244-
* The default value is XHTML1.
245-
*
246-
* \sa contentType()
244+
* Since contentType is now always HTML5, this setting is ignored.
247245
*/
248246
void setContentType(ContentType contentType);
249247

src/Wt/Test/WTestEnvironment.C

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ void WTestEnvironment::init(EntryPointType type)
100100
doesAjax_ = true;
101101
doesCookies_ = true;
102102
dpiScale_ = 1;
103-
contentType_ = XHTML1;
104103

105104
urlScheme_ = "http";
106105
referer_ = "";
@@ -224,9 +223,7 @@ void WTestEnvironment::setInternalPath(const std::string& internalPath)
224223
}
225224

226225
void WTestEnvironment::setContentType(ContentType contentType)
227-
{
228-
contentType_ = contentType;
229-
}
226+
{ }
230227

231228
void WTestEnvironment::setUserAgent(const std::string& userAgent)
232229
{

src/Wt/WApplication

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2152,11 +2152,10 @@ private:
21522152
#endif // WT_TARGET_JAVA
21532153
std::string javaScriptClass_;
21542154
AjaxMethod ajaxMethod_;
2155-
WContainerWidget *dialogCover_;
21562155
bool quited_;
21572156
std::string onePixelGifUrl_;
21582157
bool internalPathsEnabled_;
2159-
std::vector<WWidget *> exposedOnly_;
2158+
WWidget *exposedOnly_;
21602159
WLoadingIndicator *loadingIndicator_;
21612160
WWidget *loadingIndicatorWidget_;
21622161
bool connected_;
@@ -2208,9 +2207,7 @@ private:
22082207
std::map<const char *, boost::any> objectStore_;
22092208

22102209
WContainerWidget *timerRoot() const { return timerRoot_; }
2211-
WContainerWidget *dialogCover(bool create = true);
2212-
2213-
WEnvironment& env(); // short-hand for session_->env()
2210+
WEnvironment& env(); // short-hand for session_->env()
22142211

22152212
/*
22162213
* Functions for exposed signals, resources, and objects

src/Wt/WApplication.C

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ WApplication::WApplication(const WEnvironment& env
9696
eventSignalPool_(new boost::pool<>(sizeof(EventSignal<>))),
9797
#endif // WT_CNOR
9898
javaScriptClass_("Wt"),
99-
dialogCover_(0),
10099
quited_(false),
101100
internalPathsEnabled_(false),
101+
exposedOnly_(0),
102102
loadingIndicator_(0),
103103
connected_(true),
104104
bodyHtmlClassChanged_(true),
@@ -370,7 +370,6 @@ std::string WApplication::onePixelGifUrl()
370370
WApplication::~WApplication()
371371
{
372372
timerRoot_ = 0; // marker for being deleted
373-
dialogCover_ = 0;
374373

375374
delete domRoot_;
376375
domRoot_ = 0;
@@ -471,32 +470,15 @@ void WApplication::bindWidget(WWidget *widget, const std::string& domId)
471470
domRoot2_->addWidget(widget);
472471
}
473472

474-
WContainerWidget *WApplication::dialogCover(bool create)
475-
{
476-
if (dialogCover_ == 0 && create && timerRoot_) {
477-
dialogCover_ = new WContainerWidget(domRoot_);
478-
theme()->apply(domRoot_, dialogCover_, DialogCoverRole);
479-
dialogCover_->hide();
480-
}
481-
482-
return dialogCover_;
483-
}
484-
485473
void WApplication::pushExposedConstraint(WWidget *w)
486474
{
487-
exposedOnly_.push_back(w);
475+
exposedOnly_ = w;
488476
}
489477

490478
void WApplication::popExposedConstraint(WWidget *w)
491479
{
492-
for (unsigned i = exposedOnly_.size(); i > 0; --i) {
493-
unsigned j = i - 1;
494-
if (exposedOnly_[j] == w) {
495-
while (exposedOnly_.size() > j)
496-
exposedOnly_.pop_back();
497-
break;
498-
}
499-
}
480+
assert (exposedOnly_ == w);
481+
exposedOnly_ = 0;
500482
}
501483

502484
void WApplication::addGlobalWidget(WWidget *w)
@@ -523,20 +505,9 @@ bool WApplication::isExposed(WWidget *w) const
523505
if (w->parent() == timerRoot_)
524506
return true;
525507

526-
if (!exposedOnly_.empty()) {
527-
WWidget *top = exposedOnly_.back();
528-
529-
if (top->isExposed(w))
530-
return true;
531-
532-
for (WWidget *p = w->parent(); p; p = p->parent()) {
533-
if (p == domRoot_)
534-
return w != root();
535-
w = p;
536-
}
537-
538-
return false;
539-
} else {
508+
if (exposedOnly_)
509+
return exposedOnly_->isExposed(w);
510+
else {
540511
WWidget *p = w->adam();
541512
return (p == domRoot_ || p == domRoot2_);
542513
}

src/Wt/WCompositeWidget

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public:
129129
virtual bool loaded() const;
130130
virtual void setTabIndex(int index);
131131
virtual int tabIndex() const;
132+
virtual int zIndex() const;
132133
virtual void setId(const std::string& id);
133134
virtual WWidget *find(const std::string& name);
134135
virtual WWidget *findById(const std::string& name);

src/Wt/WCompositeWidget.C

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,11 @@ int WCompositeWidget::tabIndex() const
436436
return impl_->tabIndex();
437437
}
438438

439+
int WCompositeWidget::zIndex() const
440+
{
441+
return impl_->zIndex();
442+
}
443+
439444
void WCompositeWidget::setImplementation(WWidget *widget)
440445
{
441446
if (widget->parent())

src/Wt/WContainerWidget.C

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ void WContainerWidget::setLayout(WLayout *layout,
108108
flags_.set(BIT_LAYOUT_NEEDS_RERENDER);
109109

110110
if (layout) {
111+
containsLayout();
111112
WWidget::setLayout(layout);
112113
layoutImpl()->setContainer(this);
113114
}

src/Wt/WDialog

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313

1414
namespace Wt {
1515

16-
class WTable;
17-
class WTemplate;
18-
class WText;
16+
class DialogCover;
1917

2018
/*! \class WDialog Wt/WDialog Wt/WDialog
2119
* \brief A %WDialog shows a dialog.
@@ -57,7 +55,6 @@ class WText;
5755
* some intranets or extranets). \if java This functionality is only
5856
* available on Servlet 3.0 compatible servlet containers. \endif
5957
*
60-
*
6158
* Use \link setModal() setModal(false)\endlink to create a non-modal
6259
* dialog. A non-modal dialog does not block the underlying user interface:
6360
* the user must not first deal with the dialog before interacting with the
@@ -354,9 +351,6 @@ private:
354351
mutable WContainerWidget *footer_;
355352
bool modal_, resizable_;
356353

357-
int coverPreviousZIndex_;
358-
bool coverWasHidden_;
359-
360354
Signal<DialogCode> finished_;
361355

362356
DialogCode result_;
@@ -369,8 +363,8 @@ private:
369363
Wt::Signals::connection escapeConnection2_;
370364

371365
void create();
372-
void saveCoverState(WApplication *app, WContainerWidget *cover);
373-
void restoreCoverState(WApplication *app, WContainerWidget *cover);
366+
367+
DialogCover *cover();
374368
};
375369

376370
}

0 commit comments

Comments
 (0)