Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / frame / FrameView.h
index 6baec91..b7067a3 100644 (file)
@@ -25,8 +25,6 @@
 #ifndef FrameView_h
 #define FrameView_h
 
-#include "core/frame/AdjustViewSizeOrNot.h"
-#include "core/rendering/Pagination.h"
 #include "core/rendering/PaintPhase.h"
 #include "core/rendering/PartialLayoutState.h"
 #include "platform/geometry/LayoutRect.h"
@@ -52,8 +50,6 @@ class RenderScrollbarPart;
 class RenderStyle;
 class RenderWidget;
 
-Pagination::Mode paginationModeForRenderStyle(RenderStyle*);
-
 typedef unsigned long long DOMTimeStamp;
 
 class FrameView FINAL : public ScrollView {
@@ -85,12 +81,13 @@ public:
 
     void layout(bool allowSubtree = true);
     bool didFirstLayout() const;
-    void layoutTimerFired(Timer<FrameView>*);
     void scheduleRelayout();
     void scheduleRelayoutOfSubtree(RenderObject*);
-    void unscheduleRelayout();
     bool layoutPending() const;
-    bool isInPerformLayout() const { return m_inPerformLayout; }
+    bool isInPerformLayout() const;
+
+    void setCanRepaintDuringPerformLayout(bool b) { m_canRepaintDuringPerformLayout = b; }
+    bool canRepaintDuringPerformLayout() const { return m_canRepaintDuringPerformLayout; }
 
     RenderObject* layoutRoot(bool onlyDuringLayout = false) const;
     void clearLayoutSubtreeRoot() { m_layoutSubtreeRoot = 0; }
@@ -98,7 +95,6 @@ public:
 
     bool needsLayout() const;
     void setNeedsLayout();
-    void setViewportConstrainedObjectsNeedLayout();
 
     // Methods for getting/setting the size Blink should use to layout the contents.
     IntSize layoutSize(IncludeScrollbarsInRect = ExcludeScrollbars) const;
@@ -164,6 +160,7 @@ public:
     // This is different than visibleContentRect() in that it ignores negative (or overly positive)
     // offsets from rubber-banding, and it takes zooming into account.
     LayoutRect viewportConstrainedVisibleContentRect() const;
+    void viewportConstrainedVisibleContentSizeChanged(bool widthChanged, bool heightChanged);
 
     AtomicString mediaType() const;
     void setMediaType(const AtomicString&);
@@ -213,6 +210,8 @@ public:
     bool hasEverPainted() const { return m_lastPaintTime; }
     void setNodeToDraw(Node*);
 
+    bool isServicingAnimations() const { return m_servicingAnimations; }
+
     virtual void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect) OVERRIDE;
     virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect) OVERRIDE;
     virtual void paintScrollbar(GraphicsContext*, Scrollbar*, const IntRect&) OVERRIDE;
@@ -229,7 +228,7 @@ public:
     void enableAutoSizeMode(bool enable, const IntSize& minSize, const IntSize& maxSize);
 
     void forceLayout(bool allowSubtree = false);
-    void forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkFactor, AdjustViewSizeOrNot);
+    void forceLayoutForPagination(const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkFactor);
 
     bool scrollToFragment(const KURL&);
     bool scrollToAnchor(const String&);
@@ -247,7 +246,7 @@ public:
     bool isScrollable();
 
     enum ScrollbarModesCalculationStrategy { RulesFromWebContentOnly, AnyRule };
-    void calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy = AnyRule);
+    void calculateScrollbarModesForLayoutAndSetViewportRenderer(ScrollbarMode& hMode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy = AnyRule);
 
     virtual IntPoint lastKnownMousePosition() const OVERRIDE;
     bool shouldSetCursor() const;
@@ -292,15 +291,6 @@ public:
     // we need this function in order to do the scroll ourselves.
     bool wheelEvent(const PlatformWheelEvent&);
 
-    // Page and FrameView both store a Pagination value. Page::pagination() is set only by API,
-    // and FrameView::pagination() is set only by CSS. Page::pagination() will affect all
-    // FrameViews in the page cache, but FrameView::pagination() only affects the current
-    // FrameView. FrameView::pagination() will return m_pagination if it has been set. Otherwise,
-    // it will return Page::pagination() since currently there are no callers that need to
-    // distinguish between the two.
-    const Pagination& pagination() const;
-    void setPagination(const Pagination&);
-
     bool inProgrammaticScroll() const { return m_inProgrammaticScroll; }
     void setInProgrammaticScroll(bool programmaticScroll) { m_inProgrammaticScroll = programmaticScroll; }
 
@@ -340,13 +330,9 @@ private:
     void updateCanBlitOnScrollRecursively();
     bool contentsInCompositedLayer() const;
 
-    void applyOverflowToViewport(RenderObject*, ScrollbarMode& hMode, ScrollbarMode& vMode);
-    void applyPaginationToViewport();
-
+    void applyOverflowToViewportAndSetRenderer(RenderObject*, ScrollbarMode& hMode, ScrollbarMode& vMode);
     void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow);
 
-    void paintControlTints();
-
     void updateCounters();
     void autoSizeIfEnabled();
     void forceLayoutParentViewIfNeeded();
@@ -359,6 +345,8 @@ private:
 
     void gatherDebugLayoutRects(RenderObject* layoutRoot);
 
+    DocumentLifecycle& lifecycle() const;
+
     virtual void repaintContentRectangle(const IntRect&) OVERRIDE;
     virtual void contentsResized() OVERRIDE;
     virtual void scrollbarExistenceDidChange() OVERRIDE;
@@ -411,6 +399,13 @@ private:
     void setLayoutSizeInternal(const IntSize&);
 
     bool isSubtreeLayout() const { return !!m_layoutSubtreeRoot; }
+    bool repaintAllowed() const
+    {
+        if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled())
+            return true;
+
+        return !isInPerformLayout() || canRepaintDuringPerformLayout();
+    }
 
     static double s_currentFrameTimeStamp; // used for detecting decoded resource thrash in the cache
     static bool s_inPaintContents;
@@ -433,12 +428,12 @@ private:
     bool m_contentIsOpaque;
     unsigned m_slowRepaintObjectCount;
 
-    Timer<FrameView> m_layoutTimer;
-    bool m_delayedLayout;
+    bool m_hasPendingLayout;
     RenderObject* m_layoutSubtreeRoot;
 
     bool m_layoutSchedulingEnabled;
     bool m_inPerformLayout;
+    bool m_canRepaintDuringPerformLayout;
     bool m_doingPreLayoutStyleUpdate;
     bool m_inSynchronousPostLayout;
     int m_layoutCount;
@@ -461,8 +456,6 @@ private:
     bool m_verticalOverflow;
     RenderObject* m_viewportRenderer;
 
-    Pagination m_pagination;
-
     bool m_wasScrolledByUser;
     bool m_inProgrammaticScroll;
     bool m_safeToPropagateScrollToParent;
@@ -502,6 +495,8 @@ private:
 
     bool m_hasSoftwareFilters;
 
+    bool m_servicingAnimations;
+
     float m_visibleContentScaleFactor;
     IntSize m_inputEventsOffsetForEmulation;
     float m_inputEventsScaleFactorForEmulation;
@@ -538,6 +533,30 @@ inline void FrameView::incrementVisuallyNonEmptyPixelCount(const IntSize& size)
 
 DEFINE_TYPE_CASTS(FrameView, Widget, widget, widget->isFrameView(), widget.isFrameView());
 
+class AllowRepaintScope {
+public:
+    explicit AllowRepaintScope(FrameView* view)
+        : m_view(view)
+        , m_originalValue(view ? view->canRepaintDuringPerformLayout() : false)
+    {
+        if (!m_view)
+            return;
+
+        m_view->setCanRepaintDuringPerformLayout(true);
+    }
+
+    ~AllowRepaintScope()
+    {
+        if (!m_view)
+            return;
+
+        m_view->setCanRepaintDuringPerformLayout(m_originalValue);
+    }
+private:
+    FrameView* m_view;
+    bool m_originalValue;
+};
+
 } // namespace WebCore
 
 #endif // FrameView_h