- Revision
- 114249
- Author
- yael.aha...@nokia.com
- Date
- 2012-04-16 07:05:42 -0700 (Mon, 16 Apr 2012)
Log Message
[Qt][WK2] Fixed elements position is wrong after zooming.
https://bugs.webkit.org/show_bug.cgi?id=83981
Reviewed by Kenneth Rohde Christiansen.
.:
* ManualTests/remove-add-fixed-position.html: Added.
Source/WebCore:
When setFixedVisibleContentRect is called we mark all fixed elements in the frame for layout.
In order to find these elements, RenderView maintains a list of fixed elements.
They are added and removed at the same time that they are added and removed from their parent RenderBlock.
The idea is taken from the iOS5.1 branch, at opensource.apple.com.
Added a manual test that allows removing and adding fixed elements at will.
* page/FrameView.cpp:
(WebCore::FrameView::setFixedVisibleContentRect):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::insertPositionedObject):
(WebCore::RenderBlock::removePositionedObject):
* rendering/RenderView.cpp:
(WebCore::RenderView::setFixedPositionedObjectsNeedLayout):
(WebCore):
(WebCore::RenderView::insertFixedPositionedObject):
(WebCore::RenderView::removeFixedPositionedObject):
* rendering/RenderView.h:
(RenderView):
Source/WebKit2:
Turn on the flag setFixedElementsLayoutRelativeToFrame. This causes fixed elements position to be calculated based on
visibleWidth and visibleHeight. When zoom level grows, the visibleWidth and visibleHeight become smaller.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setResizesToContentsUsingLayoutSize):
Modified Paths
Added Paths
Diff
Modified: trunk/ChangeLog (114248 => 114249)
--- trunk/ChangeLog 2012-04-16 13:59:12 UTC (rev 114248)
+++ trunk/ChangeLog 2012-04-16 14:05:42 UTC (rev 114249)
@@ -1,3 +1,12 @@
+2012-04-16 Yael Aharon <yael.aha...@nokia.com>
+
+ [Qt][WK2] Fixed elements position is wrong after zooming.
+ https://bugs.webkit.org/show_bug.cgi?id=83981
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ * ManualTests/remove-add-fixed-position.html: Added.
+
2012-04-13 Jason Liu <jason....@torchmobile.com.cn>
[BlackBerry] Sign in cookie for ESPN.com does not retain login account (for fantasy sports).
Added: trunk/ManualTests/remove-add-fixed-position.html (0 => 114249)
--- trunk/ManualTests/remove-add-fixed-position.html (rev 0)
+++ trunk/ManualTests/remove-add-fixed-position.html 2012-04-16 14:05:42 UTC (rev 114249)
@@ -0,0 +1,93 @@
+<html><head>
+<meta name="viewport" content="width=device-width">
+<style>
+.d1 {position:fixed; top:5; right:5; z-index:2; overflow:hidden;}
+.o {background:green; height:40px; width:200px;}
+.t { width:2000px; height:198px; background-color: lightgray; border: 1px solid blue;}
+body { margin: 0px; }
+</style>
+<script>
+
+var fixed;
+
+function remove_child()
+{
+ fixed = document.getElementById("d1");
+ fixed.parentElement.removeChild(fixed);
+}
+
+function add_child()
+{
+ document.body.appendChild(fixed);
+}
+
+</script>
+</head>
+<body>
+<div class="d1" id="d1"><div class="o">This is a test</div></div>
+<div class="t">
+000
+</div>
+<div class="t">
+200<br>
+<button _onclick_="remove_child();">remove fixed</button>
+</div>
+<div class="t">
+400<br>
+<button _onclick_="add_child();">add fixed</button>
+</div>
+<div class="t">
+600<br>
+</div>
+<div class="t">
+800
+</div>
+<div class="t">
+1000
+</div>
+<div class="t">
+1200
+</div>
+<div class="t">
+1400
+</div>
+<div class="t">
+1600
+</div>
+<div class="t">
+1800
+</div>
+<div class="t">
+2000
+</div>
+<div class="t">
+2200
+</div>
+<div class="t">
+2400
+</div>
+<div class="t">
+2600
+</div>
+<div class="t">
+2800
+</div>
+<div class="t">
+3000
+</div>
+<div class="t">
+3200
+</div>
+<div class="t">
+3400
+</div>
+<div class="t">
+3600
+</div>
+<div class="t">
+3800
+</div>
+<div class="t">
+4000
+</div>
+</body></html>
Modified: trunk/Source/WebCore/ChangeLog (114248 => 114249)
--- trunk/Source/WebCore/ChangeLog 2012-04-16 13:59:12 UTC (rev 114248)
+++ trunk/Source/WebCore/ChangeLog 2012-04-16 14:05:42 UTC (rev 114249)
@@ -1,3 +1,29 @@
+2012-04-16 Yael Aharon <yael.aha...@nokia.com>
+
+ [Qt][WK2] Fixed elements position is wrong after zooming.
+ https://bugs.webkit.org/show_bug.cgi?id=83981
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ When setFixedVisibleContentRect is called we mark all fixed elements in the frame for layout.
+ In order to find these elements, RenderView maintains a list of fixed elements.
+ They are added and removed at the same time that they are added and removed from their parent RenderBlock.
+ The idea is taken from the iOS5.1 branch, at opensource.apple.com.
+ Added a manual test that allows removing and adding fixed elements at will.
+
+ * page/FrameView.cpp:
+ (WebCore::FrameView::setFixedVisibleContentRect):
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::insertPositionedObject):
+ (WebCore::RenderBlock::removePositionedObject):
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::setFixedPositionedObjectsNeedLayout):
+ (WebCore):
+ (WebCore::RenderView::insertFixedPositionedObject):
+ (WebCore::RenderView::removeFixedPositionedObject):
+ * rendering/RenderView.h:
+ (RenderView):
+
2012-04-13 Pavel Feldman <pfeld...@chromium.org>
Web Inspector: extract ContentProvider into its own file, make NetworkRequest, Resoruce and others implement it.
Modified: trunk/Source/WebCore/page/FrameView.cpp (114248 => 114249)
--- trunk/Source/WebCore/page/FrameView.cpp 2012-04-16 13:59:12 UTC (rev 114248)
+++ trunk/Source/WebCore/page/FrameView.cpp 2012-04-16 14:05:42 UTC (rev 114249)
@@ -1705,6 +1705,13 @@
void FrameView::setFixedVisibleContentRect(const IntRect& visibleContentRect)
{
+ if (visibleContentRect.size() != this->fixedVisibleContentRect().size()) {
+ // When the viewport size changes or the content is scaled, we need to
+ // reposition the fixed positioned elements.
+ if (RenderView* root = rootRenderer(this))
+ root->setFixedPositionedObjectsNeedLayout();
+ }
+
IntSize offset = scrollOffset();
ScrollView::setFixedVisibleContentRect(visibleContentRect);
if (offset != scrollOffset()) {
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (114248 => 114249)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-04-16 13:59:12 UTC (rev 114248)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2012-04-16 14:05:42 UTC (rev 114249)
@@ -3418,12 +3418,18 @@
m_positionedObjects = adoptPtr(new PositionedObjectsListHashSet);
m_positionedObjects->add(o);
+
+ if (o->style()->position() == FixedPosition && view())
+ view()->insertFixedPositionedObject(o);
}
void RenderBlock::removePositionedObject(RenderBox* o)
{
if (m_positionedObjects)
m_positionedObjects->remove(o);
+
+ if (view())
+ view()->removeFixedPositionedObject(o);
}
void RenderBlock::removePositionedObjects(RenderBlock* o)
Modified: trunk/Source/WebCore/rendering/RenderView.cpp (114248 => 114249)
--- trunk/Source/WebCore/rendering/RenderView.cpp 2012-04-16 13:59:12 UTC (rev 114248)
+++ trunk/Source/WebCore/rendering/RenderView.cpp 2012-04-16 14:05:42 UTC (rev 114249)
@@ -920,4 +920,35 @@
return m_intervalArena.get();
}
+void RenderView::setFixedPositionedObjectsNeedLayout()
+{
+ ASSERT(m_frameView);
+
+ PositionedObjectsListHashSet* positionedObjects = this->positionedObjects();
+ if (!positionedObjects)
+ return;
+
+ PositionedObjectsListHashSet::const_iterator end = positionedObjects->end();
+ for (PositionedObjectsListHashSet::const_iterator it = positionedObjects->begin(); it != end; ++it) {
+ RenderBox* currBox = *it;
+ currBox->setNeedsLayout(true);
+ }
+}
+
+void RenderView::insertFixedPositionedObject(RenderBox* object)
+{
+ if (!m_positionedObjects)
+ m_positionedObjects = adoptPtr(new PositionedObjectsListHashSet);
+
+ m_positionedObjects->add(object);
+}
+
+void RenderView::removeFixedPositionedObject(RenderBox* object)
+{
+ if (!m_positionedObjects)
+ return;
+
+ m_positionedObjects->remove(object);
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/RenderView.h (114248 => 114249)
--- trunk/Source/WebCore/rendering/RenderView.h 2012-04-16 13:59:12 UTC (rev 114248)
+++ trunk/Source/WebCore/rendering/RenderView.h 2012-04-16 14:05:42 UTC (rev 114249)
@@ -179,6 +179,11 @@
IntervalArena* intervalArena();
IntSize viewportSize() const { return document()->viewportSize(); }
+
+ void setFixedPositionedObjectsNeedLayout();
+ void insertFixedPositionedObject(RenderBox*);
+ void removeFixedPositionedObject(RenderBox*);
+
protected:
virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, bool* wasFixed = 0) const;
virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const;
@@ -254,7 +259,10 @@
typedef HashSet<RenderWidget*> RenderWidgetSet;
RenderWidgetSet m_widgets;
-
+
+ typedef HashSet<RenderBox*> RenderBoxSet;
+ OwnPtr<RenderBoxSet> m_fixedPositionedElements;
+
private:
unsigned m_pageLogicalHeight;
bool m_pageLogicalHeightChanged;
Modified: trunk/Source/WebKit2/ChangeLog (114248 => 114249)
--- trunk/Source/WebKit2/ChangeLog 2012-04-16 13:59:12 UTC (rev 114248)
+++ trunk/Source/WebKit2/ChangeLog 2012-04-16 14:05:42 UTC (rev 114249)
@@ -1,3 +1,16 @@
+2012-04-16 Yael Aharon <yael.aha...@nokia.com>
+
+ [Qt][WK2] Fixed elements position is wrong after zooming.
+ https://bugs.webkit.org/show_bug.cgi?id=83981
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Turn on the flag setFixedElementsLayoutRelativeToFrame. This causes fixed elements position to be calculated based on
+ visibleWidth and visibleHeight. When zoom level grows, the visibleWidth and visibleHeight become smaller.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::setResizesToContentsUsingLayoutSize):
+
2012-04-16 Kenneth Rohde Christiansen <kenn...@webkit.org>
[Qt] Clean up how the interaction engine is making use of ViewportAttributes
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (114248 => 114249)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2012-04-16 13:59:12 UTC (rev 114248)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2012-04-16 14:05:42 UTC (rev 114249)
@@ -836,6 +836,7 @@
view->setFixedLayoutSize(targetLayoutSize);
m_page->settings()->setAcceleratedCompositingForFixedPositionEnabled(true);
+ m_page->settings()->setFixedElementsLayoutRelativeToFrame(true);
// Schedule a layout to use the new target size.
if (!view->layoutPending()) {