Changeset 84978 in webkit
- Timestamp:
- Apr 26, 2011 4:31:59 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r84975 r84978 1 2011-04-26 Martin Robinson <mrobinson@igalia.com> 2 3 Reviewed by Eric Seidel. 4 5 [GTK] fast/block/float/overhanging-tall-block.html crashes in the bots 6 https://bugs.webkit.org/show_bug.cgi?id=58818 7 8 * platform/gtk/Skipped: Unskip a test which is no longer crashing. 9 1 10 2011-04-26 Mario Sanchez Prada <msanchez@igalia.com> 2 11 -
trunk/LayoutTests/platform/gtk/Skipped
r84975 r84978 183 183 # https://bugs.webkit.org/show_bug.cgi?id=56309 184 184 svg/text/text-deco-01-b.svg 185 186 # https://bugs.webkit.org/show_bug.cgi?id=58818187 fast/block/float/overhanging-tall-block.html188 185 189 186 # https://bugs.webkit.org/show_bug.cgi?id=58988 -
trunk/Source/WebCore/ChangeLog
r84976 r84978 1 2011-04-26 Martin Robinson <mrobinson@igalia.com> 2 3 Reviewed by Eric Seidel. 4 5 [GTK] fast/block/float/overhanging-tall-block.html crashes in the bots 6 https://bugs.webkit.org/show_bug.cgi?id=58818 7 8 Prevent allocating scratch buffers larger than the target GdkDrawable 9 when creating a WidgetRenderingContext. This prevents incredibly large 10 widgets from crashing the X Server. This change also allowed greatly 11 simplifying the way that the painting offset is calculated. 12 13 * platform/gtk/WidgetRenderingContext.cpp: 14 (WebCore::WidgetRenderingContext::WidgetRenderingContext): Never allocate a pixmap 15 larger than the target GdkDrawable. 16 (WebCore::WidgetRenderingContext::~WidgetRenderingContext): Calculate the offset of the 17 blit by looking at the location of the target rect itself, rather than delaying the 18 calculation up to this point. 19 (WebCore::WidgetRenderingContext::calculateClipRect): Added. 20 (WebCore::WidgetRenderingContext::gtkPaintBox): Use the new calculateClipRectHelper. 21 (WebCore::WidgetRenderingContext::gtkPaintFlatBox): Ditto. 22 (WebCore::WidgetRenderingContext::gtkPaintFocus): Ditto. 23 (WebCore::WidgetRenderingContext::gtkPaintSlider): Ditto. 24 (WebCore::WidgetRenderingContext::gtkPaintCheck): Ditto. 25 (WebCore::WidgetRenderingContext::gtkPaintOption): Ditto. 26 (WebCore::WidgetRenderingContext::gtkPaintShadow): Ditto. 27 (WebCore::WidgetRenderingContext::gtkPaintArrow): Ditto. 28 (WebCore::WidgetRenderingContext::gtkPaintVLine): Ditto. 29 * platform/gtk/WidgetRenderingContext.h: Remove some now unused members. Add 30 a member to store the IntSize mapping from the coordinates of the target to the coordinates 31 of the scratch buffer. 32 1 33 2011-04-26 Patrick Gansterer <paroga@webkit.org> 2 34 -
trunk/Source/WebCore/platform/gtk/WidgetRenderingContext.cpp
r82962 r84978 78 78 // paint directly to the target drawable. This will not render CSS rotational transforms properly. 79 79 if (!theme->m_themePartsHaveRGBAColormap && graphicsContext->gdkWindow()) { 80 m_paintRect = graphicsContext->getCTM().mapRect(targetRect);81 80 m_target = graphicsContext->gdkWindow(); 82 81 return; 83 82 } 84 83 84 // We never want to create a scratch buffer larger than the size of our target GdkDrawable. 85 // This prevents giant pixmap allocations for very large widgets in smaller views. 86 int maxWidth = 0, maxHeight = 0; 87 gdk_drawable_get_size(graphicsContext->gdkWindow(), &maxWidth, &maxHeight); 88 m_targetRect.setSize(m_targetRect.size().shrunkTo(IntSize(maxWidth, maxHeight))); 89 85 90 // Widgets sometimes need to draw outside their boundaries for things such as 86 91 // exterior focus. We want to allocate a some extra pixels in our surface for this. 87 m_extraSpace = IntSize(15, 15);88 89 // Offset the target rectangle so that the extra space is within the boundaries of the scratch buffer. 90 m_paintRect = IntRect(IntPoint(m_extraSpace.width(), m_extraSpace.height()),91 m_targetRect.size());92 93 int width = m_targetRect.width() + ( m_extraSpace.width()* 2);94 int height = m_targetRect.height() + ( m_extraSpace.height()* 2);92 static int extraSpace = 15; 93 m_targetRect.inflate(extraSpace); 94 95 // This offset will map a point in the coordinate system of the widget to the coordinate system of the painting buffer. 96 m_paintOffset = targetRect.location() - m_targetRect.location(); 97 98 int width = m_targetRect.width() + (extraSpace * 2); 99 int height = m_targetRect.height() + (extraSpace * 2); 95 100 int scratchWidth = 0; 96 101 int scratchHeight = 0; … … 133 138 RefPtr<cairo_pattern_t> previousSource(cairo_get_source(cairoContext)); 134 139 135 // The blit rectangle is the original target rectangle adjusted for any extra space. 136 IntRect fullTargetRect(m_targetRect); 137 fullTargetRect.inflateX(m_extraSpace.width()); 138 fullTargetRect.inflateY(m_extraSpace.height()); 139 140 gdk_cairo_set_source_pixmap(cairoContext, gScratchBuffer, fullTargetRect.x(), fullTargetRect.y()); 141 cairo_rectangle(cairoContext, fullTargetRect.x(), fullTargetRect.y(), fullTargetRect.width(), fullTargetRect.height()); 140 gdk_cairo_set_source_pixmap(cairoContext, gScratchBuffer, m_targetRect.x(), m_targetRect.y()); 141 cairo_rectangle(cairoContext, m_targetRect.x(), m_targetRect.y(), m_targetRect.width(), m_targetRect.height()); 142 142 cairo_fill(cairoContext); 143 143 cairo_set_source(cairoContext, previousSource.get()); … … 145 145 } 146 146 147 void WidgetRenderingContext::calculateClipRect(const IntRect& rect, GdkRectangle* clipRect) 148 { 149 clipRect->x = m_paintOffset.width() + rect.x(); 150 clipRect->y = m_paintOffset.height() + rect.y(); 151 clipRect->width = m_targetRect.width(); 152 clipRect->height = m_targetRect.height(); 153 } 154 147 155 void WidgetRenderingContext::gtkPaintBox(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, GtkShadowType shadowType, const gchar* detail) 148 156 { 149 GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() }; 157 GdkRectangle clipRect; 158 calculateClipRect(rect, &clipRect); 150 159 151 160 // Some widgets also need their allocation adjusted to account for extra space. … … 153 162 GtkAllocation allocation; 154 163 gtk_widget_get_allocation(widget, &allocation); 155 allocation.x += m_paintRect.x;156 allocation.y += m_paintRect.y;164 allocation.x += clipRect.x; 165 allocation.y += clipRect.y; 157 166 gtk_widget_set_allocation(widget, &allocation); 158 167 159 gtk_paint_box(gtk_widget_get_style(widget), m_target, stateType, shadowType, & paintRect,160 widget, detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height);168 gtk_paint_box(gtk_widget_get_style(widget), m_target, stateType, shadowType, &clipRect, 169 widget, detail, clipRect.x, clipRect.y, rect.width(), rect.height()); 161 170 } 162 171 163 172 void WidgetRenderingContext::gtkPaintFlatBox(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, GtkShadowType shadowType, const gchar* detail) 164 173 { 165 GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() }; 166 gtk_paint_flat_box(gtk_widget_get_style(widget), m_target, stateType, shadowType, &paintRect, 167 widget, detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height); 174 GdkRectangle clipRect; 175 calculateClipRect(rect, &clipRect); 176 gtk_paint_flat_box(gtk_widget_get_style(widget), m_target, stateType, shadowType, &clipRect, 177 widget, detail, clipRect.x, clipRect.y, rect.width(), rect.height()); 168 178 } 169 179 170 180 void WidgetRenderingContext::gtkPaintFocus(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, const gchar* detail) 171 181 { 172 GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() }; 173 gtk_paint_focus(gtk_widget_get_style(widget), m_target, stateType, &paintRect, widget, 174 detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height); 182 GdkRectangle clipRect; 183 calculateClipRect(rect, &clipRect); 184 gtk_paint_focus(gtk_widget_get_style(widget), m_target, stateType, &clipRect, widget, 185 detail, clipRect.x, clipRect.y, rect.width(), rect.height()); 175 186 } 176 187 177 188 void WidgetRenderingContext::gtkPaintSlider(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, GtkShadowType shadowType, const gchar* detail, GtkOrientation orientation) 178 189 { 179 GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() }; 180 gtk_paint_slider(gtk_widget_get_style(widget), m_target, stateType, shadowType, &m_paintRect, widget, 181 detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height, orientation); 190 GdkRectangle clipRect; 191 calculateClipRect(rect, &clipRect); 192 gtk_paint_slider(gtk_widget_get_style(widget), m_target, stateType, shadowType, &clipRect, widget, 193 detail, clipRect.x, clipRect.y, rect.width(), rect.height(), orientation); 182 194 } 183 195 184 196 void WidgetRenderingContext::gtkPaintCheck(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, GtkShadowType shadowType, const gchar* detail) 185 197 { 186 GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() }; 187 gtk_paint_check(gtk_widget_get_style(widget), m_target, stateType, shadowType, &paintRect, widget, 188 detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height); 198 GdkRectangle clipRect; 199 calculateClipRect(rect, &clipRect); 200 gtk_paint_check(gtk_widget_get_style(widget), m_target, stateType, shadowType, &clipRect, widget, 201 detail, clipRect.x, clipRect.y, rect.width(), rect.height()); 189 202 } 190 203 191 204 void WidgetRenderingContext::gtkPaintOption(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, GtkShadowType shadowType, const gchar* detail) 192 205 { 193 GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() }; 194 gtk_paint_option(gtk_widget_get_style(widget), m_target, stateType, shadowType, &paintRect, widget, 195 detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height); 206 GdkRectangle clipRect; 207 calculateClipRect(rect, &clipRect); 208 gtk_paint_option(gtk_widget_get_style(widget), m_target, stateType, shadowType, &clipRect, widget, 209 detail, clipRect.x, clipRect.y, rect.width(), rect.height()); 196 210 } 197 211 198 212 void WidgetRenderingContext::gtkPaintShadow(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, GtkShadowType shadowType, const gchar* detail) 199 213 { 200 GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() }; 201 gtk_paint_shadow(gtk_widget_get_style(widget), m_target, stateType, shadowType, &paintRect, widget, 202 detail, paintRect.x, paintRect.y, paintRect.width, paintRect.height); 214 GdkRectangle clipRect; 215 calculateClipRect(rect, &clipRect); 216 gtk_paint_shadow(gtk_widget_get_style(widget), m_target, stateType, shadowType, &clipRect, widget, 217 detail, clipRect.x, clipRect.y, rect.width(), rect.height()); 203 218 } 204 219 205 220 void WidgetRenderingContext::gtkPaintArrow(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, GtkShadowType shadowType, int arrowDirection, const gchar* detail) 206 221 { 207 GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() }; 208 gtk_paint_arrow(gtk_widget_get_style(widget), m_target, stateType, shadowType, &paintRect, widget, detail, 209 static_cast<GtkArrowType>(arrowDirection), TRUE, paintRect.x, paintRect.y, paintRect.width, paintRect.height); 222 GdkRectangle clipRect; 223 calculateClipRect(rect, &clipRect); 224 gtk_paint_arrow(gtk_widget_get_style(widget), m_target, stateType, shadowType, &clipRect, widget, detail, 225 static_cast<GtkArrowType>(arrowDirection), TRUE, clipRect.x, clipRect.y, rect.width(), rect.height()); 210 226 } 211 227 212 228 void WidgetRenderingContext::gtkPaintVLine(const IntRect& rect, GtkWidget* widget, GtkStateType stateType, const gchar* detail) 213 229 { 214 GdkRectangle paintRect = { m_paintRect.x + rect.x(), m_paintRect.y + rect.y(), rect.width(), rect.height() }; 215 gtk_paint_vline(gtk_widget_get_style(widget), m_target, stateType, &paintRect, widget, detail, 216 paintRect.y, paintRect.y + paintRect.height, paintRect.x); 230 GdkRectangle clipRect; 231 calculateClipRect(rect, &clipRect); 232 gtk_paint_vline(gtk_widget_get_style(widget), m_target, stateType, &clipRect, widget, detail, 233 clipRect.y, clipRect.y + rect.height(), clipRect.x); 217 234 218 235 } -
trunk/Source/WebCore/platform/gtk/WidgetRenderingContext.h
r77993 r84978 53 53 54 54 private: 55 void calculateClipRect(const IntRect&, GdkRectangle*); 56 55 57 GraphicsContext* m_graphicsContext; 56 58 IntRect m_targetRect; 57 GdkRectangle m_paintRect; 58 IntSize m_extraSpace; 59 IntSize m_paintOffset; 59 60 bool m_hadError; 60 61 GdkDrawable* m_target;
Note: See TracChangeset
for help on using the changeset viewer.