Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / frame / Frame.cpp
index 6f832d9..a39b74c 100644 (file)
@@ -47,7 +47,6 @@
 #include "core/frame/FrameHost.h"
 #include "core/frame/FrameView.h"
 #include "core/frame/Settings.h"
-#include "core/frame/animation/AnimationController.h"
 #include "core/html/HTMLFrameElementBase.h"
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/loader/EmptyClients.h"
@@ -59,6 +58,7 @@
 #include "core/page/Page.h"
 #include "core/page/scrolling/ScrollingCoordinator.h"
 #include "core/rendering/HitTestResult.h"
+#include "core/rendering/RenderLayer.h"
 #include "core/rendering/RenderLayerCompositor.h"
 #include "core/rendering/RenderPart.h"
 #include "core/rendering/RenderView.h"
@@ -79,13 +79,6 @@ using namespace HTMLNames;
 
 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, frameCounter, ("Frame"));
 
-static inline Frame* parentFromOwnerElement(HTMLFrameOwnerElement* ownerElement)
-{
-    if (!ownerElement)
-        return 0;
-    return ownerElement->document().frame();
-}
-
 static inline float parentPageZoomFactor(Frame* frame)
 {
     Frame* parent = frame->tree().parent();
@@ -104,7 +97,7 @@ static inline float parentTextZoomFactor(Frame* frame)
 
 inline Frame::Frame(PassRefPtr<FrameInit> frameInit)
     : m_host(frameInit->frameHost())
-    , m_treeNode(this, parentFromOwnerElement(frameInit->ownerElement()))
+    , m_treeNode(this)
     , m_loader(this, frameInit->frameLoaderClient())
     , m_navigationScheduler(this)
     , m_script(adoptPtr(new ScriptController(this)))
@@ -112,7 +105,6 @@ inline Frame::Frame(PassRefPtr<FrameInit> frameInit)
     , m_spellChecker(SpellChecker::create(*this))
     , m_selection(adoptPtr(new FrameSelection(this)))
     , m_eventHandler(adoptPtr(new EventHandler(this)))
-    , m_animationController(adoptPtr(new AnimationController(this)))
     , m_inputMethodController(InputMethodController::create(*this))
     , m_frameInit(frameInit)
     , m_pageZoomFactor(parentPageZoomFactor(this))
@@ -199,9 +191,6 @@ void Frame::setView(PassRefPtr<FrameView> view)
         document()->prepareForDestruction();
     }
 
-    if (m_view)
-        m_view->unscheduleRelayout();
-
     eventHandler().clear();
 
     m_view = view;
@@ -239,7 +228,7 @@ Settings* Frame::settings() const
     return 0;
 }
 
-void Frame::setPrinting(bool printing, const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkRatio, AdjustViewSizeOrNot shouldAdjustViewSize)
+void Frame::setPrinting(bool printing, const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkRatio)
 {
     // In setting printing, we should not validate resources already cached for the document.
     // See https://bugs.webkit.org/show_bug.cgi?id=43704
@@ -250,16 +239,15 @@ void Frame::setPrinting(bool printing, const FloatSize& pageSize, const FloatSiz
 
     document()->styleResolverChanged(RecalcStyleImmediately);
     if (shouldUsePrintingLayout()) {
-        view()->forceLayoutForPagination(pageSize, originalPageSize, maximumShrinkRatio, shouldAdjustViewSize);
+        view()->forceLayoutForPagination(pageSize, originalPageSize, maximumShrinkRatio);
     } else {
         view()->forceLayout();
-        if (shouldAdjustViewSize == AdjustViewSize)
-            view()->adjustViewSize();
+        view()->adjustViewSize();
     }
 
     // Subframes of the one we're printing don't lay out to the page size.
     for (RefPtr<Frame> child = tree().firstChild(); child; child = child->tree().nextSibling())
-        child->setPrinting(printing, FloatSize(), FloatSize(), 0, shouldAdjustViewSize);
+        child->setPrinting(printing, FloatSize(), FloatSize(), 0);
 }
 
 bool Frame::shouldUsePrintingLayout() const
@@ -338,17 +326,17 @@ RenderPart* Frame::ownerRenderer() const
     return toRenderPart(object);
 }
 
-void Frame::dispatchVisibilityStateChangeEvent()
+void Frame::didChangeVisibilityState()
 {
     if (document())
-        document()->dispatchVisibilityStateChangeEvent();
+        document()->didChangeVisibilityState();
 
     Vector<RefPtr<Frame> > childFrames;
     for (Frame* child = tree().firstChild(); child; child = child->tree().nextSibling())
         childFrames.append(child);
 
     for (size_t i = 0; i < childFrames.size(); ++i)
-        childFrames[i]->dispatchVisibilityStateChangeEvent();
+        childFrames[i]->didChangeVisibilityState();
 }
 
 void Frame::willDetachFrameHost()
@@ -589,15 +577,11 @@ void Frame::setPageAndTextZoomFactors(float pageZoomFactor, float textZoomFactor
     m_pageZoomFactor = pageZoomFactor;
     m_textZoomFactor = textZoomFactor;
 
-    document->recalcStyle(Force);
-
     for (RefPtr<Frame> child = tree().firstChild(); child; child = child->tree().nextSibling())
         child->setPageAndTextZoomFactors(m_pageZoomFactor, m_textZoomFactor);
 
-    if (FrameView* view = this->view()) {
-        if (document->renderer() && document->renderer()->needsLayout() && view->didFirstLayout())
-            view->layout();
-    }
+    document->setNeedsStyleRecalc(SubtreeStyleChange);
+    document->updateLayoutIgnorePendingStylesheets();
 }
 
 void Frame::deviceOrPageScaleFactorChanged()
@@ -699,6 +683,8 @@ PassOwnPtr<DragImage> Frame::nodeImage(Node* node)
     buffer->context()->translate(-paintingRect.x(), -paintingRect.y());
     buffer->context()->clip(FloatRect(0, 0, paintingRect.maxX(), paintingRect.maxY()));
 
+    // https://code.google.com/p/chromium/issues/detail?id=343755
+    DisableCompositingQueryAsserts disabler;
     m_view->paintContents(buffer->context(), paintingRect);
 
     RefPtr<Image> image = buffer->copyImage();
@@ -740,8 +726,7 @@ double Frame::devicePixelRatio() const
         return 0;
 
     double ratio = m_host->deviceScaleFactor();
-    if (RuntimeEnabledFeatures::devicePixelRatioIncludesZoomEnabled())
-        ratio *= pageZoomFactor();
+    ratio *= pageZoomFactor();
     return ratio;
 }