OpenLayers OpenLayers

Ticket #1500 (closed bug: fixed)

Opened 2 years ago

Last modified 2 years ago

.olPopup class CSS breaks popup autosizing

Reported by: sbenthall Assigned to: euzuro
Priority: critical Milestone: 2.7 Release
Component: Popup Version: 2.6 RC1
Keywords: Cc:
State: Complete

Description

Including CSS that is particular to the .olPopup CSS class that changes the dimensions of the popup content breaks.

This is because OpenLayers.Util.getRenderedDimensions rendered the content off screen without the CSS context (that any popup content would have).

See attached example (depends on image files in the /examples directory)

Attachments

popupMatrix.html (11.5 kB) - added by sbenthall on 04/07/08 17:32:44.
popupMatrix-broke.html (11.5 kB) - added by sbenthall on 07/29/08 23:11:02.
this example is better.
popupCSS.patch (4.9 kB) - added by sbenthall on 07/29/08 23:44:51.

Change History

04/07/08 17:32:44 changed by sbenthall

  • attachment popupMatrix.html added.

04/07/08 18:04:51 changed by crschmidt

  • milestone changed from 2.6 Release to 2.7 Release.

07/04/08 00:50:28 changed by euzuro

  • status changed from new to assigned.

07/28/08 12:53:31 changed by crschmidt

  • priority changed from minor to critical.

07/29/08 20:25:20 changed by sbenthall

  • owner changed from euzuro to sbenthall.
  • status changed from assigned to new.

07/29/08 20:25:33 changed by sbenthall

  • status changed from new to assigned.

07/29/08 23:08:40 changed by sbenthall

The example included is actually pretty sucky, since the padding on .olPopup img is (correctly) affecting the images of the frame of the Framed popup.

A better example of this would use a style on .olPopupContent img

07/29/08 23:11:02 changed by sbenthall

  • attachment popupMatrix-broke.html added.

this example is better.

07/29/08 23:44:51 changed by sbenthall

  • attachment popupCSS.patch added.

07/29/08 23:48:39 changed by sbenthall

  • owner changed from sbenthall to euzuro.
  • status changed from assigned to new.
  • state set to Review.

That attached patch: - adds an argument to Util.getRenderedDimensions that puts a CSS class on the rendered div. - makes popups give the olPopup CSS class to getRenderedDimensions when calculating the rendered content size. - wraps the contentHTML with a div with the popup's content div style before passing it off to getRenderDimensions to calculate its size. - pushes some CSS class constants within Popup classes to properties

I think this solves the problem. I'd love to get it reviewed. It's be happy to write some tests if somebody thought they would be useful here.

07/30/08 01:11:50 changed by euzuro

  • status changed from new to assigned.

08/03/08 14:47:53 changed by crschmidt

  • status changed from assigned to closed.
  • state changed from Review to Complete.
  • resolution set to fixed.

(In [7684]) Improve getRenderedDimensions to take into account a CSS class. Refactor some popup code to take advantage of this, to provide a better hint to the getRenderedDimensions call as to what is going on. Patch from sbenthall, r=me, includes a manual acceptance test (only because the testing framework makes these kinds of things hard). Manually confirmed to work with the sundials.html example, tested with that and manual test in IE6, IE7, FF2-Win FF3-Mac FF2-Mac Safari-Mac Opera-Win, and in all browsers it worked. (Hooray!) Nice one, sbenthall. (Closes #1500)