diff --git a/src/html.cc b/src/html.cc
index 3b9d4ac..7b71e45 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -516,7 +516,6 @@ DilloHtml::DilloHtml(BrowserWindow *p_bw, const DilloUrl *url,
/* Init page-handling variables */
forms.reserve(1);
links.reserve(64);
- images = new misc::SimpleVector (16);
/* Initialize the main widget */
initDw();
@@ -552,13 +551,13 @@ DilloHtml::~DilloHtml()
delete page_url;
delete base_url;
- for (int i = 0; i < images->size(); i++) {
- DilloHtmlImage *img = images->get(i);
+ for (int i = 0; i < images.size(); i++) {
+ DilloHtmlImage *img = images.at(i);
img->url.reset(); // Was: delete img->url;
img->image.reset(); // Was: a_Image_unref(img->image);
dFree(img);
}
- delete (images);
+ images.clear();
}
/**
@@ -676,8 +675,8 @@ DilloHtmlForm *DilloHtml::getCurrentForm ()
bool_t DilloHtml::unloadedImages()
{
- for (int i = 0; i < images->size(); i++) {
- if (images->get(i)->image != NULL) {
+ for (int i = 0; i < images.size(); i++) {
+ if (images.at(i)->image != NULL) {
return TRUE;
}
}
@@ -700,8 +699,8 @@ void DilloHtml::loadImages (const DilloUrl *pattern)
*/
const DilloUrl *requester = pattern ? NULL : this->page_url;
- for (int i = 0; i < images->size(); i++) {
- DilloHtmlImage *hi = images->get(i);
+ for (int i = 0; i < images.size(); i++) {
+ DilloHtmlImage *hi = images.at(i);
if (hi->image) {
assert(hi->url);
@@ -756,8 +755,8 @@ bool DilloHtml::HtmlLinkReceiver::press (Widget *widget, int link, int img,
// image menu
if (link != -1)
linkurl = html->links.at(link).get();
- const bool_t loaded_img = (html->images->get(img)->image == NULL);
- a_UIcmd_image_popup(bw, html->images->get(img)->url.get(), loaded_img,
+ const bool_t loaded_img = (html->images.at(img)->image == NULL);
+ a_UIcmd_image_popup(bw, html->images.at(img)->url.get(), loaded_img,
html->page_url, linkurl);
ret = true;
} else {
@@ -781,11 +780,11 @@ bool DilloHtml::HtmlLinkReceiver::click (Widget *widget, int link, int img,
{
BrowserWindow *bw = html->bw;
- if ((img != -1) && (html->images->get(img)->image)) {
+ if ((img != -1) && (html->images.at(img)->image)) {
// clicked an image that has not already been loaded
if (event->button == 1){
// load all instances of this image
- DilloUrl *pattern = html->images->get(img)->url.get();
+ DilloUrl *pattern = html->images.at(img)->url.get();
html->loadImages(pattern);
return true;
}
@@ -2101,7 +2100,7 @@ void a_Html_common_image_attrs(DilloHtml *html, const char *tag, int tagsize)
/* x_img is an index to a list of {url,image} pairs.
* We know a_Html_image_new() will use size() as its next index */
html->styleEngine->setNonCssHint (PROPERTY_X_IMG, CSS_TYPE_INTEGER,
- html->images->size());
+ html->images.size());
}
std::shared_ptr< DilloImage > a_Html_image_new(DilloHtml *html, const char *tag, int tagsize)
@@ -2133,8 +2132,7 @@ std::shared_ptr< DilloImage > a_Html_image_new(DilloHtml *html, const char *tag,
DilloHtmlImage *hi = new DilloHtmlImage{};
hi->url = std::move( url );
- html->images->increase();
- html->images->set(html->images->size() - 1, hi);
+ html->images.push_back(hi);
load_now = prefs.load_images ||
!dStrAsciiCasecmp(URL_SCHEME(hi->url.get()), "data") ||
@@ -2308,8 +2306,8 @@ static void Html_tag_close_map(DilloHtml *html)
* an image that has not been loaded (img != NULL), tell the image to
* redraw. (It will only do so if it uses a map.)
*/
- for (int i = 0; i < html->images->size(); i++) {
- std::shared_ptr< DilloImage > img = html->images->get(i)->image;
+ for (int i = 0; i < html->images.size(); i++) {
+ std::shared_ptr< DilloImage > img = html->images.at(i)->image;
if (img) {
// At this point, we know that img->ir represents an image
diff --git a/src/html_common.hh b/src/html_common.hh
index 16fe6fc..1154180 100644
--- a/src/html_common.hh
+++ b/src/html_common.hh
@@ -222,7 +222,7 @@ public: //BUG: for now everything is public
std::vector< std::unique_ptr< DilloHtmlForm > > forms;
std::vector< std::shared_ptr< DilloHtmlInput > > inputs_outside_form;
std::vector< std::unique_ptr< DilloUrl > > links;
- lout::misc::SimpleVector *images;
+ std::vector< DilloHtmlImage * > images;
dw::ImageMapsList maps;
private: