Title: [98604] branches/safari-534.52-branch/Source/WebCore

Diff

Modified: branches/safari-534.52-branch/Source/WebCore/ChangeLog (98603 => 98604)


--- branches/safari-534.52-branch/Source/WebCore/ChangeLog	2011-10-27 17:46:20 UTC (rev 98603)
+++ branches/safari-534.52-branch/Source/WebCore/ChangeLog	2011-10-27 17:52:17 UTC (rev 98604)
@@ -1,3 +1,33 @@
+2011-10-27  Lucas Forschler  <lforsch...@apple.com>
+
+    Merge 98304
+
+    2011-10-24  Anders Carlsson  <ander...@apple.com>
+
+            It should be possible for Widget subclasses to control whether transforms affect the frame rect
+            https://bugs.webkit.org/show_bug.cgi?id=70787
+
+            Reviewed by Sam Weinig.
+
+            Currently RenderWidget sets the frame rect of it's hosted widget to the bounding box of the transformed
+            content box rect (unless the Widget is a frame view). It should be possible for Widget subclasses to override
+            this behavior and have the frame rect set to the absolute content box without any transforms applied.
+
+            * platform/Widget.h:
+            (WebCore::Widget::transformsAffectFrameRect):
+            Add new member function.
+
+            * rendering/RenderWidget.cpp:
+            (WebCore::RenderWidget::updateWidgetGeometry):
+            Move shared code from setWidget and updateWidgetPosition out into a new function. If transformsAffectFrameRect returns 
+            false, just set the frame rect to the absolute content box.
+
+            (WebCore::RenderWidget::setWidget):
+            (WebCore::RenderWidget::updateWidgetPosition):
+            Call updateWidgetGeometry.
+
+            * rendering/RenderWidget.h:
+
 2011-10-26  Lucas Forschler  <lforsch...@apple.com>
 
     Merge 98178

Modified: branches/safari-534.52-branch/Source/WebCore/platform/Widget.h (98603 => 98604)


--- branches/safari-534.52-branch/Source/WebCore/platform/Widget.h	2011-10-27 17:46:20 UTC (rev 98603)
+++ branches/safari-534.52-branch/Source/WebCore/platform/Widget.h	2011-10-27 17:52:17 UTC (rev 98604)
@@ -215,6 +215,10 @@
     // Notifies this widget that other widgets on the page have been repositioned.
     virtual void widgetPositionsUpdated() {}
 
+    // Whether transforms affect the frame rect. FIXME: We get rid of this and have
+    // the frame rects be the same no matter what transforms are applied.
+    virtual bool transformsAffectFrameRect() { return true; }
+
 #if PLATFORM(MAC)
     NSView* getOuterView() const;
 

Modified: branches/safari-534.52-branch/Source/WebCore/rendering/RenderWidget.cpp (98603 => 98604)


--- branches/safari-534.52-branch/Source/WebCore/rendering/RenderWidget.cpp	2011-10-27 17:46:20 UTC (rev 98603)
+++ branches/safari-534.52-branch/Source/WebCore/rendering/RenderWidget.cpp	2011-10-27 17:52:17 UTC (rev 98604)
@@ -191,6 +191,21 @@
     return boundsChanged;
 }
 
+bool RenderWidget::updateWidgetGeometry() 
+{ 
+    IntRect contentBox = contentBoxRect(); 
+     if (!m_widget->transformsAffectFrameRect()) 
+         return setWidgetGeometry(absoluteContentBox(), contentBox.size()); 
+      
+     IntRect absoluteContentBox = IntRect(localToAbsoluteQuad(FloatQuad(contentBox)).boundingBox()); 
+     if (m_widget->isFrameView()) { 
+         contentBox.setLocation(absoluteContentBox.location()); 
+         return setWidgetGeometry(contentBox, contentBox.size()); 
+     } 
+      
+     return setWidgetGeometry(absoluteContentBox, contentBox.size()); 
+}
+
 void RenderWidget::setWidget(PassRefPtr<Widget> widget)
 {
     if (widget == m_widget)
@@ -208,15 +223,9 @@
         // widget immediately, but we have to have really been fully constructed (with a non-null
         // style pointer).
         if (style()) {
-            if (!needsLayout()) {
-                IntRect contentBox = contentBoxRect();
-                IntRect absoluteContentBox = IntRect(localToAbsoluteQuad(FloatQuad(contentBox)).boundingBox());
-                if (m_widget->isFrameView()) {
-                    contentBox.setLocation(absoluteContentBox.location());
-                    setWidgetGeometry(contentBox, contentBox.size());
-                } else
-                    setWidgetGeometry(absoluteContentBox, contentBox.size());
-            }
+            if (!needsLayout()) 
+                updateWidgetGeometry();
+                
             if (style()->visibility() != VISIBLE)
                 m_widget->hide();
             else {
@@ -354,15 +363,7 @@
     if (!m_widget || !node()) // Check the node in case destroy() has been called.
         return;
 
-    IntRect contentBox = contentBoxRect();
-    IntRect absoluteContentBox = IntRect(localToAbsoluteQuad(FloatQuad(contentBox)).boundingBox());
-    bool boundsChanged;
-    if (m_widget->isFrameView()) {
-        contentBox.setLocation(absoluteContentBox.location());
-        boundsChanged = setWidgetGeometry(contentBox, contentBox.size());
-    } else
-        boundsChanged = setWidgetGeometry(absoluteContentBox, contentBox.size());
-    
+    bool boundsChanged = updateWidgetGeometry();     
     // if the frame bounds got changed, or if view needs layout (possibly indicating
     // content size is wrong) we have to do a layout to set the right widget size
     if (m_widget && m_widget->isFrameView()) {

Modified: branches/safari-534.52-branch/Source/WebCore/rendering/RenderWidget.h (98603 => 98604)


--- branches/safari-534.52-branch/Source/WebCore/rendering/RenderWidget.h	2011-10-27 17:46:20 UTC (rev 98603)
+++ branches/safari-534.52-branch/Source/WebCore/rendering/RenderWidget.h	2011-10-27 17:52:17 UTC (rev 98604)
@@ -71,6 +71,7 @@
     virtual void setOverlapTestResult(bool);
 
     bool setWidgetGeometry(const IntRect&, const IntSize&);
+    bool updateWidgetGeometry();
 
     RefPtr<Widget> m_widget;
     RefPtr<Image> m_substituteImage;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to