summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/RenderFlowThread.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-03-12 14:11:15 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-03-12 14:11:15 +0100
commitdd91e772430dc294e3bf478c119ef8d43c0a3358 (patch)
tree6f33ce4d5872a5691e0291eb45bf6ab373a5f567 /Source/WebCore/rendering/RenderFlowThread.cpp
parentad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (diff)
downloadqtwebkit-dd91e772430dc294e3bf478c119ef8d43c0a3358.tar.gz
Imported WebKit commit 3db4eb1820ac8fb03065d7ea73a4d9db1e8fea1a (http://svn.webkit.org/repository/webkit/trunk@110422)
This includes build fixes for the latest qtbase/qtdeclarative as well as the final QML2 API.
Diffstat (limited to 'Source/WebCore/rendering/RenderFlowThread.cpp')
-rw-r--r--Source/WebCore/rendering/RenderFlowThread.cpp70
1 files changed, 68 insertions, 2 deletions
diff --git a/Source/WebCore/rendering/RenderFlowThread.cpp b/Source/WebCore/rendering/RenderFlowThread.cpp
index 9e47d4dc9..e241d9670 100644
--- a/Source/WebCore/rendering/RenderFlowThread.cpp
+++ b/Source/WebCore/rendering/RenderFlowThread.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2011 Adobe Systems Incorporated. All Rights Reserved.
+ * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -13,7 +13,7 @@
* disclaimer in the documentation and/or other materials
* provided with the distribution.
*
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
@@ -905,4 +905,70 @@ void RenderFlowThread::computeOverflowStateForRegions(LayoutUnit oldClientAfterE
m_overflow = lastReg && (lastReg->regionState() == RenderRegion::RegionOverflow);
}
+bool RenderFlowThread::regionInRange(const RenderRegion* targetRegion, const RenderRegion* startRegion, const RenderRegion* endRegion) const
+{
+ ASSERT(targetRegion);
+
+ for (RenderRegionList::const_iterator it = m_regionList.find(const_cast<RenderRegion*>(startRegion)); it != m_regionList.end(); ++it) {
+ const RenderRegion* currRegion = *it;
+ if (!currRegion->isValid())
+ continue;
+ if (targetRegion == currRegion)
+ return true;
+ if (currRegion == endRegion)
+ break;
+ }
+
+ return false;
+}
+
+bool RenderFlowThread::objectInFlowRegion(const RenderObject* object, const RenderRegion* region) const
+{
+ ASSERT(object);
+ ASSERT(region);
+
+ if (!object->inRenderFlowThread())
+ return false;
+ if (object->enclosingRenderFlowThread() != this)
+ return false;
+ if (!m_regionList.contains(const_cast<RenderRegion*>(region)))
+ return false;
+
+ RenderBox* enclosingBox = object->enclosingBox();
+ RenderRegion* enclosingBoxStartRegion = 0;
+ RenderRegion* enclosingBoxEndRegion = 0;
+ getRegionRangeForBox(enclosingBox, enclosingBoxStartRegion, enclosingBoxEndRegion);
+ if (!regionInRange(region, enclosingBoxStartRegion, enclosingBoxEndRegion))
+ return false;
+
+ if (object->isBox())
+ return true;
+
+ LayoutRect objectABBRect = object->absoluteBoundingBoxRect(true);
+ if (!objectABBRect.width())
+ objectABBRect.setWidth(1);
+ if (!objectABBRect.height())
+ objectABBRect.setHeight(1);
+ if (objectABBRect.intersects(region->absoluteBoundingBoxRect(true)))
+ return true;
+
+ if (region == lastRegion()) {
+ // If the object does not intersect any of the enclosing box regions
+ // then the object is in last region.
+ for (RenderRegionList::const_iterator it = m_regionList.find(enclosingBoxStartRegion); it != m_regionList.end(); ++it) {
+ const RenderRegion* currRegion = *it;
+ if (!region->isValid())
+ continue;
+ if (currRegion == region)
+ break;
+ if (objectABBRect.intersects(currRegion->absoluteBoundingBoxRect(true)))
+ return false;
+ }
+ return true;
+ }
+
+ return false;
+}
+
} // namespace WebCore
+