Re: form input button and margin
"corvid" <[email protected]>
| Newsgroups | gmane.comp.web.dillo.devel |
|---|---|
| Message-ID | <20130203215549.GB24050@local> |
I wrote: > In the second one, the words and the button overlap. I'm not immediately > sure what's special enough about that case to cause that. Here's some quick code made by looking at how the image code is working. I would not be surprised if there are still complications lurking somewhere in textblock, but it's at least something to play with... Aside: It seems that, at least for firefox, the border is the edge of a button or text entry widget or whatever, and padding goes inside that. Of course we're not in any position to do that, but it's interesting. _______________________________________________ Dillo-dev mailing list [email protected] http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
form_widget_box_model.diff
(text/plain, 2.1 KB)
diff -r 8c8975054b06 dw/ui.cc
--- a/dw/ui.cc Wed Jan 30 10:04:00 2013 +0100
+++ b/dw/ui.cc Sun Feb 03 21:46:37 2013 +0000
@@ -47,6 +47,10 @@
void Embed::sizeRequestImpl (Requisition *requisition)
{
resource->sizeRequest (requisition);
+
+ requisition->width += getStyle()->boxDiffWidth ();
+ requisition->ascent += getStyle()->boxOffsetY ();
+ requisition->descent += getStyle()->boxRestHeight ();
}
void Embed::getExtremesImpl (Extremes *extremes)
@@ -56,7 +60,15 @@
void Embed::sizeAllocateImpl (Allocation *allocation)
{
- resource->sizeAllocate (allocation);
+ Allocation a;
+
+ a.x = allocation->x + getStyle()->boxOffsetX ();
+ a.y = allocation->y + getStyle()->boxOffsetY ();
+ a.width = allocation->width - getStyle()->boxDiffWidth ();
+ a.ascent = allocation->ascent - getStyle()->boxDiffHeight ();
+ a.descent = allocation->descent;
+
+ resource->sizeAllocate (&a);
}
void Embed::enterNotifyImpl (core::EventCrossing *event)
@@ -111,8 +123,15 @@
void Embed::draw (View *view, Rectangle *area)
{
+ core::Rectangle r;
+
drawWidgetBox (view, area, false);
- resource->draw (view, area);
+
+ r.x = getStyle()->boxOffsetX ();
+ r.y = getStyle()->boxOffsetY ();
+ r.width = getContentWidth ();
+ r.height = getContentHeight ();
+ resource->draw (view, &r);
}
Iterator *Embed::iterator (Content::Type mask, bool atEnd)
diff -r 8c8975054b06 src/form.cc
--- a/src/form.cc Wed Jan 30 10:04:00 2013 +0100
+++ b/src/form.cc Sun Feb 03 21:46:37 2013 +0000
@@ -858,7 +858,12 @@
* but it caused 100% CPU usage.
*/
page = new Textblock (false);
- page->setStyle (html->styleEngine->backgroundStyle ());
+ StyleAttrs boxlessAttrs = *(html->styleEngine->backgroundStyle ());
+ boxlessAttrs.padding.setVal (0);
+ boxlessAttrs.borderWidth.setVal (0);
+ boxlessAttrs.margin.setVal (0);
+ Style *boxlessStyle = Style::create(&boxlessAttrs);
+ page->setStyle (boxlessStyle);
ResourceFactory *factory = HT2LT(html)->getResourceFactory();
Resource *resource = factory->createComplexButtonResource(page, true);