Changeset 144067 in webkit
- Timestamp:
- Feb 26, 2013, 9:16:35 AM (14 years ago)
- Location:
- trunk/Source
- Files:
-
- 10 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/html/HTMLPlugInElement.h (modified) (1 diff)
-
WebCore/html/HTMLPlugInImageElement.cpp (modified) (1 diff)
-
WebCore/html/HTMLPlugInImageElement.h (modified) (2 diffs)
-
WebCore/rendering/RenderEmbeddedObject.cpp (modified) (1 diff)
-
WebCore/rendering/RenderEmbeddedObject.h (modified) (1 diff)
-
WebCore/rendering/RenderWidget.cpp (modified) (2 diffs)
-
WebCore/rendering/RenderWidget.h (modified) (1 diff)
-
WebKit2/ChangeLog (modified) (1 diff)
-
WebKit2/WebProcess/Plugins/PluginView.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r144065 r144067 1 2013-02-26 Dean Jackson <dino@apple.com> 2 3 Draw intermediate snapshots if possible 4 https://bugs.webkit.org/show_bug.cgi?id=110811 5 6 Reviewed by Simon Fraser. 7 8 After http://webkit.org/b/110495 we delayed snapshotting until we've 9 received a nice image, but this made the page look like it is broken. 10 We should draw any intermediate snapshots that we find, which might 11 include content such as progress bars/spinners. 12 13 * html/HTMLPlugInElement.h: 14 (WebCore::HTMLPlugInElement::isPlugInImageElement): Expose virtual method 15 to indicate if this is a HTMLPlugInImageElement or not. 16 * html/HTMLPlugInImageElement.cpp: 17 (WebCore::HTMLPlugInImageElement::updateSnapshot): If we have 18 a RenderEmbeddedObject renderer, then tell it to repaint. 19 * html/HTMLPlugInImageElement.h: 20 (WebCore::HTMLPlugInImageElement::snapshotImage): Expose an 21 accessor for snapshot images. 22 * rendering/RenderEmbeddedObject.cpp: 23 (WebCore::RenderEmbeddedObject::paintSnapshotImage): New helper 24 method to render an image directly. This code is similar to 25 that in RenderSnapshottedPlugIn. 26 (WebCore::RenderEmbeddedObject::paintContents): The virtual implementation 27 of this method for use when we have a snapshot to paint. If we are a plugin that is 28 in the process of being snapshotted, ask our HTMLPlugInImageElement for a 29 snapshot and paint that instead. In the case where we are not snapshotting, 30 or we do not yet have a snapshot, this will call back into the RenderWidget code. 31 * rendering/RenderEmbeddedObject.h: 32 (RenderEmbeddedObject): New methods paintSnapshotImage and paintContents 33 * rendering/RenderWidget.cpp: 34 (WebCore::RenderWidget::paintContents): New method called in the middle 35 of paint() that can be overridden by RenderEmbeddedObject. The code here was 36 simply moved out of the previous paint(). 37 (WebCore::RenderWidget::paint): Call paintContents at the appropriate time. 38 * rendering/RenderWidget.h: 39 (RenderWidget): New virtual method paintContents. 40 1 41 2013-02-26 Levi Weintraub <leviw@chromium.org> 2 42 -
trunk/Source/WebCore/html/HTMLPlugInElement.h
r143843 r144067 75 75 virtual bool willRespondToMouseClickEvents() OVERRIDE; 76 76 77 virtual bool isPlugInImageElement() const { return false; } 78 77 79 protected: 78 80 HTMLPlugInElement(const QualifiedName& tagName, Document*); -
trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp
r143684 r144067 285 285 286 286 m_snapshotImage = image; 287 287 288 if (renderer()->isSnapshottedPlugIn()) { 288 289 toRenderSnapshottedPlugIn(renderer())->updateSnapshot(image); 289 290 return; 290 291 } 292 293 if (renderer()->isEmbeddedObject()) 294 renderer()->repaint(); 291 295 } 292 296 -
trunk/Source/WebCore/html/HTMLPlugInImageElement.h
r143680 r144067 67 67 void userDidClickSnapshot(PassRefPtr<MouseEvent>); 68 68 void updateSnapshotInfo(); 69 Image* snapshotImage() const { return m_snapshotImage.get(); } 69 70 70 71 // Plug-in URL might not be the same as url() with overriding parameters. … … 112 113 void swapRendererTimerFired(Timer<HTMLPlugInImageElement>*); 113 114 115 virtual bool isPlugInImageElement() const OVERRIDE { return true; } 116 114 117 bool m_needsWidgetUpdate; 115 118 bool m_shouldPreferPlugInsForImages; -
trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp
r137847 r144067 149 149 } 150 150 151 void RenderEmbeddedObject::paintSnapshotImage(PaintInfo& paintInfo, const LayoutPoint& paintOffset, Image* image) 152 { 153 LayoutUnit cWidth = contentWidth(); 154 LayoutUnit cHeight = contentHeight(); 155 if (!cWidth || !cHeight) 156 return; 157 158 GraphicsContext* context = paintInfo.context; 159 LayoutSize contentSize(cWidth, cHeight); 160 LayoutPoint contentLocation = location() + paintOffset; 161 contentLocation.move(borderLeft() + paddingLeft(), borderTop() + paddingTop()); 162 163 LayoutRect rect(contentLocation, contentSize); 164 IntRect alignedRect = pixelSnappedIntRect(rect); 165 if (alignedRect.width() <= 0 || alignedRect.height() <= 0) 166 return; 167 168 bool useLowQualityScaling = shouldPaintAtLowQuality(context, image, image, alignedRect.size()); 169 context->drawImage(image, style()->colorSpace(), alignedRect, CompositeSourceOver, shouldRespectImageOrientation(), useLowQualityScaling); 170 } 171 172 void RenderEmbeddedObject::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 173 { 174 Element* element = static_cast<Element*>(node()); 175 if (!element || !element->isPluginElement()) 176 return; 177 178 HTMLPlugInElement* plugInElement = static_cast<HTMLPlugInElement*>(element); 179 if (plugInElement->displayState() > HTMLPlugInElement::DisplayingSnapshot) { 180 RenderPart::paintContents(paintInfo, paintOffset); 181 return; 182 } 183 184 if (!plugInElement->isPlugInImageElement()) 185 return; 186 187 Image* snapshot = static_cast<HTMLPlugInImageElement*>(plugInElement)->snapshotImage(); 188 if (snapshot) 189 paintSnapshotImage(paintInfo, paintOffset, snapshot); 190 } 191 151 192 void RenderEmbeddedObject::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 152 193 { -
trunk/Source/WebCore/rendering/RenderEmbeddedObject.h
r140640 r144067 76 76 virtual bool isEmbeddedObject() const { return true; } 77 77 78 void paintSnapshotImage(PaintInfo&, const LayoutPoint&, Image*); 79 virtual void paintContents(PaintInfo&, const LayoutPoint&) OVERRIDE; 80 78 81 #if USE(ACCELERATED_COMPOSITING) 79 82 virtual bool requiresLayer() const; -
trunk/Source/WebCore/rendering/RenderWidget.cpp
r143990 r144067 236 236 } 237 237 238 void RenderWidget::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 239 { 240 LayoutPoint adjustedPaintOffset = paintOffset + location(); 241 242 // Tell the widget to paint now. This is the only time the widget is allowed 243 // to paint itself. That way it will composite properly with z-indexed layers. 244 IntPoint widgetLocation = m_widget->frameRect().location(); 245 IntPoint paintLocation(roundToInt(adjustedPaintOffset.x() + borderLeft() + paddingLeft()), 246 roundToInt(adjustedPaintOffset.y() + borderTop() + paddingTop())); 247 IntRect paintRect = paintInfo.rect; 248 249 IntSize widgetPaintOffset = paintLocation - widgetLocation; 250 // When painting widgets into compositing layers, tx and ty are relative to the enclosing compositing layer, 251 // not the root. In this case, shift the CTM and adjust the paintRect to be root-relative to fix plug-in drawing. 252 if (!widgetPaintOffset.isZero()) { 253 paintInfo.context->translate(widgetPaintOffset); 254 paintRect.move(-widgetPaintOffset); 255 } 256 m_widget->paint(paintInfo.context, paintRect); 257 258 if (!widgetPaintOffset.isZero()) 259 paintInfo.context->translate(-widgetPaintOffset); 260 261 if (m_widget->isFrameView()) { 262 FrameView* frameView = static_cast<FrameView*>(m_widget.get()); 263 bool runOverlapTests = !frameView->useSlowRepaintsIfNotOverlapped() || frameView->hasCompositedContentIncludingDescendants(); 264 if (paintInfo.overlapTestRequests && runOverlapTests) { 265 ASSERT(!paintInfo.overlapTestRequests->contains(this)); 266 paintInfo.overlapTestRequests->set(this, m_widget->frameRect()); 267 } 268 } 269 } 270 238 271 void RenderWidget::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 239 272 { … … 275 308 } 276 309 277 if (m_widget) { 278 // Tell the widget to paint now. This is the only time the widget is allowed 279 // to paint itself. That way it will composite properly with z-indexed layers. 280 IntPoint widgetLocation = m_widget->frameRect().location(); 281 IntPoint paintLocation(roundToInt(adjustedPaintOffset.x() + borderLeft() + paddingLeft()), 282 roundToInt(adjustedPaintOffset.y() + borderTop() + paddingTop())); 283 IntRect paintRect = paintInfo.rect; 284 285 IntSize widgetPaintOffset = paintLocation - widgetLocation; 286 // When painting widgets into compositing layers, tx and ty are relative to the enclosing compositing layer, 287 // not the root. In this case, shift the CTM and adjust the paintRect to be root-relative to fix plug-in drawing. 288 if (!widgetPaintOffset.isZero()) { 289 paintInfo.context->translate(widgetPaintOffset); 290 paintRect.move(-widgetPaintOffset); 291 } 292 m_widget->paint(paintInfo.context, paintRect); 293 294 if (!widgetPaintOffset.isZero()) 295 paintInfo.context->translate(-widgetPaintOffset); 296 297 if (m_widget->isFrameView()) { 298 FrameView* frameView = static_cast<FrameView*>(m_widget.get()); 299 bool runOverlapTests = !frameView->useSlowRepaintsIfNotOverlapped() || frameView->hasCompositedContentIncludingDescendants(); 300 if (paintInfo.overlapTestRequests && runOverlapTests) { 301 ASSERT(!paintInfo.overlapTestRequests->contains(this)); 302 paintInfo.overlapTestRequests->set(this, m_widget->frameRect()); 303 } 304 } 305 } 310 if (m_widget) 311 paintContents(paintInfo, paintOffset); 306 312 307 313 if (style()->hasBorderRadius()) -
trunk/Source/WebCore/rendering/RenderWidget.h
r140640 r144067 86 86 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE; 87 87 88 virtual void paintContents(PaintInfo&, const LayoutPoint&); 89 88 90 private: 89 91 virtual bool isWidget() const { return true; } -
trunk/Source/WebKit2/ChangeLog
r144066 r144067 1 2013-02-26 Dean Jackson <dino@apple.com> 2 3 Draw intermediate snapshots if possible 4 https://bugs.webkit.org/show_bug.cgi?id=110811 5 6 Reviewed by Simon Fraser. 7 8 After http://webkit.org/b/110495 we delayed snapshotting until we've 9 received a nice image, but this made the page look like it is broken. 10 We should draw any intermediate snapshots that we find, which might 11 include content such as progress bars/spinners. 12 13 * WebProcess/Plugins/PluginView.cpp: 14 (WebKit): Reinstate 60 attempts at snapshots before giving up. 15 (WebKit::PluginView::isAcceleratedCompositingEnabled): We do not 16 want accelerated compositing enabled when we are trying to capture 17 snapshots. 18 1 19 2013-02-26 Andras Becsi <andras.becsi@digia.com> 2 20 -
trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp
r143976 r144067 72 72 // This simulated mouse click delay in HTMLPlugInImageElement.cpp should generally be the same or shorter than this delay. 73 73 static const double pluginSnapshotTimerDelay = 1.1; 74 static const unsigned maximumSnapshotRetries = 4;74 static const unsigned maximumSnapshotRetries = 60; 75 75 76 76 class PluginView::URLRequest : public RefCounted<URLRequest> { … … 1350 1350 return false; 1351 1351 1352 if (m_pluginElement->displayState() < HTMLPlugInElement::PlayingWithPendingMouseClick) 1353 return false; 1352 1354 return settings->acceleratedCompositingEnabled(); 1353 1355 }
Note:
See TracChangeset
for help on using the changeset viewer.