Modified: trunk/Source/WebCore/ChangeLog (178532 => 178533)
--- trunk/Source/WebCore/ChangeLog 2015-01-15 22:52:30 UTC (rev 178532)
+++ trunk/Source/WebCore/ChangeLog 2015-01-15 23:13:38 UTC (rev 178533)
@@ -1,3 +1,57 @@
+2015-01-15 Zalan Bujtas <[email protected]>
+
+ Move ClipRects and ClipRectsCache classes to RenderLayer.cpp.
+ https://bugs.webkit.org/show_bug.cgi?id=140461
+
+ Reviewed by Simon Fraser.
+
+ Move classes only used by RenderLayer to RenderLayer.cpp.
+
+ No change in functionality.
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::ClipRects::create):
+ (WebCore::ClipRects::reset):
+ (WebCore::ClipRects::overflowClipRect):
+ (WebCore::ClipRects::setOverflowClipRect):
+ (WebCore::ClipRects::fixedClipRect):
+ (WebCore::ClipRects::setFixedClipRect):
+ (WebCore::ClipRects::posClipRect):
+ (WebCore::ClipRects::setPosClipRect):
+ (WebCore::ClipRects::fixed):
+ (WebCore::ClipRects::setFixed):
+ (WebCore::ClipRects::ref):
+ (WebCore::ClipRects::deref):
+ (WebCore::ClipRects::operator==):
+ (WebCore::ClipRects::operator=):
+ (WebCore::ClipRects::ClipRects):
+ (WebCore::ClipRectsCache::ClipRectsCache):
+ (WebCore::ClipRectsCache::getClipRects):
+ (WebCore::ClipRectsCache::setClipRects):
+ (WebCore::ClipRectsCache::getIndex):
+ (WebCore::RenderLayer::clipRects):
+ (WebCore::RenderLayer::calculateClipRects):
+ * rendering/RenderLayer.h:
+ (WebCore::ClipRects::create): Deleted.
+ (WebCore::ClipRects::ClipRects): Deleted.
+ (WebCore::ClipRects::reset): Deleted.
+ (WebCore::ClipRects::overflowClipRect): Deleted.
+ (WebCore::ClipRects::setOverflowClipRect): Deleted.
+ (WebCore::ClipRects::fixedClipRect): Deleted.
+ (WebCore::ClipRects::setFixedClipRect): Deleted.
+ (WebCore::ClipRects::posClipRect): Deleted.
+ (WebCore::ClipRects::setPosClipRect): Deleted.
+ (WebCore::ClipRects::fixed): Deleted.
+ (WebCore::ClipRects::setFixed): Deleted.
+ (WebCore::ClipRects::ref): Deleted.
+ (WebCore::ClipRects::deref): Deleted.
+ (WebCore::ClipRects::operator==): Deleted.
+ (WebCore::ClipRects::operator=): Deleted.
+ (WebCore::ClipRectsCache::ClipRectsCache): Deleted.
+ (WebCore::ClipRectsCache::getClipRects): Deleted.
+ (WebCore::ClipRectsCache::setClipRects): Deleted.
+ (WebCore::ClipRectsCache::getIndex): Deleted.
+
2015-01-15 Dhi Aurrahman <[email protected]>
Canonicalization of :lang() should preserve the :lang()'s arguments representations
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (178532 => 178533)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2015-01-15 22:52:30 UTC (rev 178532)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2015-01-15 23:13:38 UTC (rev 178533)
@@ -133,6 +133,121 @@
using namespace HTMLNames;
+class ClipRects {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ static PassRefPtr<ClipRects> create()
+ {
+ return adoptRef(new ClipRects);
+ }
+
+ static PassRefPtr<ClipRects> create(const ClipRects& other)
+ {
+ return adoptRef(new ClipRects(other));
+ }
+
+ ClipRects() = default;
+
+ void reset(const LayoutRect& clipRect)
+ {
+ m_overflowClipRect = clipRect;
+ m_fixedClipRect = clipRect;
+ m_posClipRect = clipRect;
+ m_fixed = false;
+ }
+
+ const ClipRect& overflowClipRect() const { return m_overflowClipRect; }
+ void setOverflowClipRect(const ClipRect& clipRect) { m_overflowClipRect = clipRect; }
+
+ const ClipRect& fixedClipRect() const { return m_fixedClipRect; }
+ void setFixedClipRect(const ClipRect& clipRect) { m_fixedClipRect = clipRect; }
+
+ const ClipRect& posClipRect() const { return m_posClipRect; }
+ void setPosClipRect(const ClipRect& clipRect) { m_posClipRect = clipRect; }
+
+ bool fixed() const { return m_fixed; }
+ void setFixed(bool fixed) { m_fixed = fixed; }
+
+ void ref() { m_refCount++; }
+ void deref()
+ {
+ if (!--m_refCount)
+ delete this;
+ }
+
+ bool operator==(const ClipRects& other) const
+ {
+ return m_overflowClipRect == other.overflowClipRect()
+ && m_fixedClipRect == other.fixedClipRect()
+ && m_posClipRect == other.posClipRect()
+ && m_fixed == other.fixed();
+ }
+
+ ClipRects& operator=(const ClipRects& other)
+ {
+ m_overflowClipRect = other.overflowClipRect();
+ m_fixedClipRect = other.fixedClipRect();
+ m_posClipRect = other.posClipRect();
+ m_fixed = other.fixed();
+ return *this;
+ }
+
+private:
+ ClipRects(const LayoutRect& clipRect)
+ : m_overflowClipRect(clipRect)
+ , m_fixedClipRect(clipRect)
+ , m_posClipRect(clipRect)
+ {
+ }
+
+ ClipRects(const ClipRects& other)
+ : m_overflowClipRect(other.overflowClipRect())
+ , m_fixedClipRect(other.fixedClipRect())
+ , m_posClipRect(other.posClipRect())
+ , m_fixed(other.fixed())
+ {
+ }
+
+ ClipRect m_overflowClipRect;
+ ClipRect m_fixedClipRect;
+ ClipRect m_posClipRect;
+ unsigned m_refCount = 1;
+ bool m_fixed = false;
+};
+
+class ClipRectsCache {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ ClipRectsCache()
+ {
+#ifndef NDEBUG
+ for (int i = 0; i < NumCachedClipRectsTypes; ++i) {
+ m_clipRectsRoot[i] = 0;
+ m_scrollbarRelevancy[i] = IgnoreOverlayScrollbarSize;
+ }
+#endif
+ }
+
+ PassRefPtr<ClipRects> getClipRects(ClipRectsType clipRectsType, ShouldRespectOverflowClip respectOverflow) { return m_clipRects[getIndex(clipRectsType, respectOverflow)]; }
+ void setClipRects(ClipRectsType clipRectsType, ShouldRespectOverflowClip respectOverflow, PassRefPtr<ClipRects> clipRects) { m_clipRects[getIndex(clipRectsType, respectOverflow)] = clipRects; }
+
+#ifndef NDEBUG
+ const RenderLayer* m_clipRectsRoot[NumCachedClipRectsTypes];
+ OverlayScrollbarSizeRelevancy m_scrollbarRelevancy[NumCachedClipRectsTypes];
+#endif
+
+private:
+ int getIndex(ClipRectsType clipRectsType, ShouldRespectOverflowClip respectOverflow)
+ {
+ int index = static_cast<int>(clipRectsType);
+ if (respectOverflow == RespectOverflowClip)
+ index += static_cast<int>(NumCachedClipRectsTypes);
+ return index;
+ }
+
+ RefPtr<ClipRects> m_clipRects[NumCachedClipRectsTypes * 2];
+};
+
void makeMatrixRenderable(TransformationMatrix& matrix, bool has3DRendering)
{
#if !ENABLE(3D_RENDERING)
@@ -5288,6 +5403,12 @@
return true;
}
+ClipRects* RenderLayer::clipRects(const ClipRectsContext& context) const
+{
+ ASSERT(context.clipRectsType < NumCachedClipRectsTypes);
+ return m_clipRectsCache ? m_clipRectsCache->getClipRects(context.clipRectsType, context.respectOverflowClip).get() : 0;
+}
+
void RenderLayer::calculateClipRects(const ClipRectsContext& clipRectsContext, ClipRects& clipRects) const
{
if (!parent()) {
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (178532 => 178533)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2015-01-15 22:52:30 UTC (rev 178532)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2015-01-15 23:13:38 UTC (rev 178533)
@@ -55,6 +55,8 @@
namespace WebCore {
+class ClipRects;
+class ClipRectsCache;
class FilterEffectRenderer;
class FilterEffectRendererHelper;
class FilterOperations;
@@ -83,95 +85,6 @@
NeedsFullRepaintForPositionedMovementLayout
};
-class ClipRects {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- static PassRefPtr<ClipRects> create()
- {
- return adoptRef(new ClipRects);
- }
-
- static PassRefPtr<ClipRects> create(const ClipRects& other)
- {
- return adoptRef(new ClipRects(other));
- }
-
- ClipRects()
- : m_refCnt(1)
- , m_fixed(false)
- {
- }
-
- void reset(const LayoutRect& r)
- {
- m_overflowClipRect = r;
- m_fixedClipRect = r;
- m_posClipRect = r;
- m_fixed = false;
- }
-
- const ClipRect& overflowClipRect() const { return m_overflowClipRect; }
- void setOverflowClipRect(const ClipRect& r) { m_overflowClipRect = r; }
-
- const ClipRect& fixedClipRect() const { return m_fixedClipRect; }
- void setFixedClipRect(const ClipRect&r) { m_fixedClipRect = r; }
-
- const ClipRect& posClipRect() const { return m_posClipRect; }
- void setPosClipRect(const ClipRect& r) { m_posClipRect = r; }
-
- bool fixed() const { return m_fixed; }
- void setFixed(bool fixed) { m_fixed = fixed; }
-
- void ref() { m_refCnt++; }
- void deref()
- {
- if (!--m_refCnt)
- delete this;
- }
-
- bool operator==(const ClipRects& other) const
- {
- return m_overflowClipRect == other.overflowClipRect() &&
- m_fixedClipRect == other.fixedClipRect() &&
- m_posClipRect == other.posClipRect() &&
- m_fixed == other.fixed();
- }
-
- ClipRects& operator=(const ClipRects& other)
- {
- m_overflowClipRect = other.overflowClipRect();
- m_fixedClipRect = other.fixedClipRect();
- m_posClipRect = other.posClipRect();
- m_fixed = other.fixed();
- return *this;
- }
-
-private:
- ClipRects(const LayoutRect& r)
- : m_overflowClipRect(r)
- , m_fixedClipRect(r)
- , m_posClipRect(r)
- , m_refCnt(1)
- , m_fixed(false)
- {
- }
-
- ClipRects(const ClipRects& other)
- : m_overflowClipRect(other.overflowClipRect())
- , m_fixedClipRect(other.fixedClipRect())
- , m_posClipRect(other.posClipRect())
- , m_refCnt(1)
- , m_fixed(other.fixed())
- {
- }
-
- ClipRect m_overflowClipRect;
- ClipRect m_fixedClipRect;
- ClipRect m_posClipRect;
- unsigned m_refCnt : 31;
- bool m_fixed : 1;
-};
-
enum ClipRectsType {
PaintingClipRects, // Relative to painting ancestor. Used for painting.
RootRelativeClipRects, // Relative to the ancestor treated as the root (e.g. transformed layer). Used for hit testing.
@@ -191,39 +104,6 @@
IgnoreRootOffsetForFragments
};
-struct ClipRectsCache {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- ClipRectsCache()
- {
-#ifndef NDEBUG
- for (int i = 0; i < NumCachedClipRectsTypes; ++i) {
- m_clipRectsRoot[i] = 0;
- m_scrollbarRelevancy[i] = IgnoreOverlayScrollbarSize;
- }
-#endif
- }
-
- PassRefPtr<ClipRects> getClipRects(ClipRectsType clipRectsType, ShouldRespectOverflowClip respectOverflow) { return m_clipRects[getIndex(clipRectsType, respectOverflow)]; }
- void setClipRects(ClipRectsType clipRectsType, ShouldRespectOverflowClip respectOverflow, PassRefPtr<ClipRects> clipRects) { m_clipRects[getIndex(clipRectsType, respectOverflow)] = clipRects; }
-
-#ifndef NDEBUG
- const RenderLayer* m_clipRectsRoot[NumCachedClipRectsTypes];
- OverlayScrollbarSizeRelevancy m_scrollbarRelevancy[NumCachedClipRectsTypes];
-#endif
-
-private:
- int getIndex(ClipRectsType clipRectsType, ShouldRespectOverflowClip respectOverflow)
- {
- int index = static_cast<int>(clipRectsType);
- if (respectOverflow == RespectOverflowClip)
- index += static_cast<int>(NumCachedClipRectsTypes);
- return index;
- }
-
- RefPtr<ClipRects> m_clipRects[NumCachedClipRectsTypes * 2];
-};
-
class RenderLayer final : public ScrollableArea {
WTF_MAKE_FAST_ALLOCATED;
public:
@@ -598,18 +478,6 @@
void calculateRects(const ClipRectsContext&, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds,
ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, const LayoutSize& offsetFromRoot) const;
- // Compute and cache clip rects computed with the given layer as the root
- void updateClipRects(const ClipRectsContext&);
- // Compute and return the clip rects. If useCached is true, will used previously computed clip rects on ancestors
- // (rather than computing them all from scratch up the parent chain).
- void calculateClipRects(const ClipRectsContext&, ClipRects&) const;
-
- ClipRects* clipRects(const ClipRectsContext& context) const
- {
- ASSERT(context.clipRectsType < NumCachedClipRectsTypes);
- return m_clipRectsCache ? m_clipRectsCache->getClipRects(context.clipRectsType, context.respectOverflowClip).get() : 0;
- }
-
LayoutRect childrenClipRect() const; // Returns the foreground clip rect of the layer in the document's coordinate space.
LayoutRect selfClipRect() const; // Returns the background clip rect of the layer in the document's coordinate space.
LayoutRect localClipRect(bool& clipExceedsBounds) const; // Returns the background clip rect of the layer in the local coordinate space.
@@ -801,6 +669,13 @@
bool clipToDirtyRect;
};
+ // Compute and cache clip rects computed with the given layer as the root
+ void updateClipRects(const ClipRectsContext&);
+ // Compute and return the clip rects. If useCached is true, will used previously computed clip rects on ancestors
+ // (rather than computing them all from scratch up the parent chain).
+ void calculateClipRects(const ClipRectsContext&, ClipRects&) const;
+ ClipRects* clipRects(const ClipRectsContext&) const;
+
void updateZOrderLists();
void rebuildZOrderLists();
void rebuildZOrderLists(CollectLayersBehavior, std::unique_ptr<Vector<RenderLayer*>>&, std::unique_ptr<Vector<RenderLayer*>>&);