Title: [125574] trunk/Source/WebKit/blackberry
- Revision
- 125574
- Author
- [email protected]
- Date
- 2012-08-14 10:09:55 -0700 (Tue, 14 Aug 2012)
Log Message
[BlackBerry] Double-tap zoom on blocks on cnn.com desktop page doesn't work
https://bugs.webkit.org/show_bug.cgi?id=93895
Reviewed by Antonio Gomes.
Patch by Jacky Jiang <[email protected]>
PR: 188232
When adjusting block zoom node, don't choose a node if the width of the
node size is very close to the width of the actual visible size as
block zoom can do nothing on such kind of node. This condition is more
restrictive than the one based on area and can bail out early.
In this way, we can get a better node for double-tap zoom.
* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::bestNodeForZoomUnderPoint):
(BlackBerry::WebKit::WebPagePrivate::adjustedBlockZoomNodeForZoomAndExpandingRatioLimits):
* Api/WebPage_p.h:
(WebPagePrivate):
Modified Paths
Diff
Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (125573 => 125574)
--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-08-14 17:01:37 UTC (rev 125573)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2012-08-14 17:09:55 UTC (rev 125574)
@@ -2809,7 +2809,7 @@
if (!originalNode)
return 0;
Node* node = bestChildNodeForClickRect(originalNode, clickRect);
- return node ? adjustedBlockZoomNodeForZoomLimits(node) : adjustedBlockZoomNodeForZoomLimits(originalNode);
+ return node ? adjustedBlockZoomNodeForZoomAndExpandingRatioLimits(node) : adjustedBlockZoomNodeForZoomAndExpandingRatioLimits(originalNode);
}
Node* WebPagePrivate::bestChildNodeForClickRect(Node* parentNode, const IntRect& clickRect)
@@ -2877,33 +2877,26 @@
return node;
}
-Node* WebPagePrivate::adjustedBlockZoomNodeForZoomLimits(Node* node)
+Node* WebPagePrivate::adjustedBlockZoomNodeForZoomAndExpandingRatioLimits(Node* node)
{
Node* initialNode = node;
RenderObject* renderer = node->renderer();
bool acceptableNodeSize = newScaleForBlockZoomRect(rectForNode(node), 1.0, 0) < maxBlockZoomScale();
+ IntSize actualVisibleSize = this->actualVisibleSize();
while (!renderer || !acceptableNodeSize) {
node = node->parentNode();
+ IntRect nodeRect = rectForNode(node);
- if (!node)
+ // Don't choose a node if the width of the node size is very close to the width of the actual visible size,
+ // as block zoom can do nothing on such kind of node.
+ if (!node || static_cast<double>(actualVisibleSize.width() - nodeRect.width()) / actualVisibleSize.width() < minimumExpandingRatio)
return initialNode;
renderer = node->renderer();
acceptableNodeSize = newScaleForBlockZoomRect(rectForNode(node), 1.0, 0) < maxBlockZoomScale();
}
- // Don't use a node if it is too close to the size of the actual contents.
- if (initialNode != node) {
- IntRect nodeRect = rectForNode(node);
- nodeRect = adjustRectOffsetForFrameOffset(nodeRect, node);
- nodeRect.intersect(IntRect(IntPoint::zero(), contentsSize()));
- int nodeArea = nodeRect.width() * nodeRect.height();
- int pageArea = contentsSize().width() * contentsSize().height();
- if (static_cast<double>(pageArea - nodeArea) / pageArea < minimumExpandingRatio)
- return initialNode;
- }
-
return node;
}
Modified: trunk/Source/WebKit/blackberry/Api/WebPage_p.h (125573 => 125574)
--- trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2012-08-14 17:01:37 UTC (rev 125573)
+++ trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2012-08-14 17:09:55 UTC (rev 125574)
@@ -291,7 +291,7 @@
WebCore::Node* bestNodeForZoomUnderPoint(const WebCore::IntPoint&);
WebCore::Node* bestChildNodeForClickRect(WebCore::Node* parentNode, const WebCore::IntRect& clickRect);
WebCore::Node* nodeForZoomUnderPoint(const WebCore::IntPoint&);
- WebCore::Node* adjustedBlockZoomNodeForZoomLimits(WebCore::Node*);
+ WebCore::Node* adjustedBlockZoomNodeForZoomAndExpandingRatioLimits(WebCore::Node*);
WebCore::IntRect rectForNode(WebCore::Node*);
WebCore::IntRect blockZoomRectForNode(WebCore::Node*);
WebCore::IntRect adjustRectOffsetForFrameOffset(const WebCore::IntRect&, const WebCore::Node*);
Modified: trunk/Source/WebKit/blackberry/ChangeLog (125573 => 125574)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-08-14 17:01:37 UTC (rev 125573)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-08-14 17:09:55 UTC (rev 125574)
@@ -1,3 +1,24 @@
+2012-08-14 Jacky Jiang <[email protected]>
+
+ [BlackBerry] Double-tap zoom on blocks on cnn.com desktop page doesn't work
+ https://bugs.webkit.org/show_bug.cgi?id=93895
+
+ Reviewed by Antonio Gomes.
+ Patch by Jacky Jiang <[email protected]>
+
+ PR: 188232
+ When adjusting block zoom node, don't choose a node if the width of the
+ node size is very close to the width of the actual visible size as
+ block zoom can do nothing on such kind of node. This condition is more
+ restrictive than the one based on area and can bail out early.
+ In this way, we can get a better node for double-tap zoom.
+
+ * Api/WebPage.cpp:
+ (BlackBerry::WebKit::WebPagePrivate::bestNodeForZoomUnderPoint):
+ (BlackBerry::WebKit::WebPagePrivate::adjustedBlockZoomNodeForZoomAndExpandingRatioLimits):
+ * Api/WebPage_p.h:
+ (WebPagePrivate):
+
2012-08-14 Konrad Piascik <[email protected]>
[BlackBerry] Change the call to setUserScalable to use the setting.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes