Title: [98304] trunk/Source/WebCore
- Revision
- 98304
- Author
- [email protected]
- Date
- 2011-10-24 17:33:10 -0700 (Mon, 24 Oct 2011)
Log Message
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:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (98303 => 98304)
--- trunk/Source/WebCore/ChangeLog 2011-10-25 00:26:40 UTC (rev 98303)
+++ trunk/Source/WebCore/ChangeLog 2011-10-25 00:33:10 UTC (rev 98304)
@@ -1,3 +1,29 @@
+2011-10-24 Anders Carlsson <[email protected]>
+
+ 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-24 Arko Saha <[email protected]>
Microdata: Add itemprop, itemref, itemvalue attributes.
Modified: trunk/Source/WebCore/platform/Widget.h (98303 => 98304)
--- trunk/Source/WebCore/platform/Widget.h 2011-10-25 00:26:40 UTC (rev 98303)
+++ trunk/Source/WebCore/platform/Widget.h 2011-10-25 00:33:10 UTC (rev 98304)
@@ -198,6 +198,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: trunk/Source/WebCore/rendering/RenderWidget.cpp (98303 => 98304)
--- trunk/Source/WebCore/rendering/RenderWidget.cpp 2011-10-25 00:26:40 UTC (rev 98303)
+++ trunk/Source/WebCore/rendering/RenderWidget.cpp 2011-10-25 00:33:10 UTC (rev 98304)
@@ -166,6 +166,21 @@
return boundsChanged;
}
+bool RenderWidget::updateWidgetGeometry()
+{
+ IntRect contentBox = contentBoxRect();
+ if (!m_widget->transformsAffectFrameRect())
+ return setWidgetGeometry(absoluteContentBox());
+
+ IntRect absoluteContentBox = IntRect(localToAbsoluteQuad(FloatQuad(contentBox)).boundingBox());
+ if (m_widget->isFrameView()) {
+ contentBox.setLocation(absoluteContentBox.location());
+ return setWidgetGeometry(contentBox);
+ }
+
+ return setWidgetGeometry(absoluteContentBox);
+}
+
void RenderWidget::setWidget(PassRefPtr<Widget> widget)
{
if (widget == m_widget)
@@ -183,15 +198,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);
- } else
- setWidgetGeometry(absoluteContentBox);
- }
+ if (!needsLayout())
+ updateWidgetGeometry();
+
if (style()->visibility() != VISIBLE)
m_widget->hide();
else {
@@ -321,14 +330,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);
- } else
- boundsChanged = setWidgetGeometry(absoluteContentBox);
+ 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
Modified: trunk/Source/WebCore/rendering/RenderWidget.h (98303 => 98304)
--- trunk/Source/WebCore/rendering/RenderWidget.h 2011-10-25 00:26:40 UTC (rev 98303)
+++ trunk/Source/WebCore/rendering/RenderWidget.h 2011-10-25 00:33:10 UTC (rev 98304)
@@ -71,6 +71,7 @@
virtual void setOverlapTestResult(bool);
bool setWidgetGeometry(const IntRect&);
+ bool updateWidgetGeometry();
RefPtr<Widget> m_widget;
FrameView* m_frameView;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes