Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: Source/core/page/FrameView.cpp

Issue 14614007: Remove frame flattening from rendering code. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Got it. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/page/FrameView.h ('k') | Source/core/page/Settings.in » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 // make it update the rendering area when set 473 // make it update the rendering area when set
474 m_margins.setWidth(w); 474 m_margins.setWidth(w);
475 } 475 }
476 476
477 void FrameView::setMarginHeight(LayoutUnit h) 477 void FrameView::setMarginHeight(LayoutUnit h)
478 { 478 {
479 // make it update the rendering area when set 479 // make it update the rendering area when set
480 m_margins.setHeight(h); 480 m_margins.setHeight(h);
481 } 481 }
482 482
483 bool FrameView::avoidScrollbarCreation() const
484 {
485 ASSERT(m_frame);
486
487 // with frame flattening no subframe can have scrollbars
488 // but we also cannot turn scrollbars off as we determine
489 // our flattening policy using that.
490
491 if (!m_frame->ownerElement())
492 return false;
493
494 if (!m_frame->settings() || m_frame->settings()->frameFlatteningEnabled())
495 return true;
496
497 return false;
498 }
499
500 void FrameView::setCanHaveScrollbars(bool canHaveScrollbars) 483 void FrameView::setCanHaveScrollbars(bool canHaveScrollbars)
501 { 484 {
502 m_canHaveScrollbars = canHaveScrollbars; 485 m_canHaveScrollbars = canHaveScrollbars;
503 ScrollView::setCanHaveScrollbars(canHaveScrollbars); 486 ScrollView::setCanHaveScrollbars(canHaveScrollbars);
504 } 487 }
505 488
506 void FrameView::updateCanHaveScrollbars() 489 void FrameView::updateCanHaveScrollbars()
507 { 490 {
508 ScrollbarMode hMode; 491 ScrollbarMode hMode;
509 ScrollbarMode vMode; 492 ScrollbarMode vMode;
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 hMode = ScrollbarAlwaysOff; 668 hMode = ScrollbarAlwaysOff;
686 vMode = ScrollbarAlwaysOff; 669 vMode = ScrollbarAlwaysOff;
687 } 670 }
688 671
689 if (!m_layoutRoot) { 672 if (!m_layoutRoot) {
690 Document* document = m_frame->document(); 673 Document* document = m_frame->document();
691 Node* documentElement = document->documentElement(); 674 Node* documentElement = document->documentElement();
692 RenderObject* rootRenderer = documentElement ? documentElement->renderer () : 0; 675 RenderObject* rootRenderer = documentElement ? documentElement->renderer () : 0;
693 Node* body = document->body(); 676 Node* body = document->body();
694 if (body && body->renderer()) { 677 if (body && body->renderer()) {
695 if (body->hasTagName(framesetTag) && m_frame->settings() && !m_frame ->settings()->frameFlatteningEnabled()) { 678 if (body->hasTagName(framesetTag)) {
696 vMode = ScrollbarAlwaysOff; 679 vMode = ScrollbarAlwaysOff;
697 hMode = ScrollbarAlwaysOff; 680 hMode = ScrollbarAlwaysOff;
698 } else if (body->hasTagName(bodyTag)) { 681 } else if (body->hasTagName(bodyTag)) {
699 // It's sufficient to just check the X overflow, 682 // It's sufficient to just check the X overflow,
700 // since it's illegal to have visible in only one direction. 683 // since it's illegal to have visible in only one direction.
701 RenderObject* o = rootRenderer->style()->overflowX() == OVISIBLE && document->documentElement()->hasTagName(htmlTag) ? body->renderer() : rootRe nderer; 684 RenderObject* o = rootRenderer->style()->overflowX() == OVISIBLE && document->documentElement()->hasTagName(htmlTag) ? body->renderer() : rootRe nderer;
702 applyOverflowToViewport(o, hMode, vMode); 685 applyOverflowToViewport(o, hMode, vMode);
703 } 686 }
704 } else if (rootRenderer) 687 } else if (rootRenderer)
705 applyOverflowToViewport(rootRenderer, hMode, vMode); 688 applyOverflowToViewport(rootRenderer, hMode, vMode);
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 return; 874 return;
892 875
893 TRACE_EVENT0("webkit", "FrameView::layout"); 876 TRACE_EVENT0("webkit", "FrameView::layout");
894 877
895 // Protect the view from being deleted during layout (in recalcStyle) 878 // Protect the view from being deleted during layout (in recalcStyle)
896 RefPtr<FrameView> protector(this); 879 RefPtr<FrameView> protector(this);
897 880
898 // Every scroll that happens during layout is programmatic. 881 // Every scroll that happens during layout is programmatic.
899 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e); 882 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e);
900 883
901 bool inChildFrameLayoutWithFrameFlattening = isInChildFrameWithFrameFlatteni ng();
902
903 if (inChildFrameLayoutWithFrameFlattening) {
904 if (doLayoutWithFrameFlattening(allowSubtree))
905 return;
906 }
907
908 m_layoutTimer.stop(); 884 m_layoutTimer.stop();
909 m_delayedLayout = false; 885 m_delayedLayout = false;
910 m_setNeedsLayoutWasDeferred = false; 886 m_setNeedsLayoutWasDeferred = false;
911 887
912 if (!m_frame) { 888 if (!m_frame) {
913 // FIXME: Do we need to set m_size.width here? 889 // FIXME: Do we need to set m_size.width here?
914 // FIXME: Should we set m_size.height here too? 890 // FIXME: Should we set m_size.height here too?
915 m_size.setWidth(layoutWidth()); 891 m_size.setWidth(layoutWidth());
916 return; 892 return;
917 } 893 }
(...skipping 12 matching lines...) Expand all
930 906
931 ASSERT(m_frame->view() == this); 907 ASSERT(m_frame->view() == this);
932 908
933 Document* document = m_frame->document(); 909 Document* document = m_frame->document();
934 bool subtree; 910 bool subtree;
935 RenderObject* root; 911 RenderObject* root;
936 912
937 { 913 {
938 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false); 914 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false);
939 915
940 if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_postLayoutTa sksTimer.isActive() && !inChildFrameLayoutWithFrameFlattening) { 916 if (!m_nestedLayoutCount && !m_inSynchronousPostLayout && m_postLayoutTa sksTimer.isActive() && !frame()->document()->shouldDisplaySeamlesslyWithParent() ) {
Mike West 2013/05/14 08:33:03 We missed this last time. inChildFrameLayoutWithFr
941 // This is a new top-level layout. If there are any remaining tasks from the previous 917 // This is a new top-level layout. If there are any remaining tasks from the previous
942 // layout, finish them now. 918 // layout, finish them now.
943 m_inSynchronousPostLayout = true; 919 m_inSynchronousPostLayout = true;
944 performPostLayoutTasks(); 920 performPostLayoutTasks();
945 m_inSynchronousPostLayout = false; 921 m_inSynchronousPostLayout = false;
946 } 922 }
947 923
948 document->evaluateMediaQueryList(); 924 document->evaluateMediaQueryList();
949 925
950 // If there is any pagination to apply, it will affect the RenderView's style, so we should 926 // If there is any pagination to apply, it will affect the RenderView's style, so we should
(...skipping 25 matching lines...) Expand all
976 RenderLayer* layer; 952 RenderLayer* layer;
977 { 953 {
978 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false); 954 TemporaryChange<bool> changeSchedulingEnabled(m_layoutSchedulingEnabled, false);
979 955
980 m_nestedLayoutCount++; 956 m_nestedLayoutCount++;
981 957
982 if (!m_layoutRoot) { 958 if (!m_layoutRoot) {
983 Document* document = m_frame->document(); 959 Document* document = m_frame->document();
984 Node* body = document->body(); 960 Node* body = document->body();
985 if (body && body->renderer()) { 961 if (body && body->renderer()) {
986 if (body->hasTagName(framesetTag) && m_frame->settings() && !m_f rame->settings()->frameFlatteningEnabled()) { 962 if (body->hasTagName(framesetTag)) {
987 body->renderer()->setChildNeedsLayout(true); 963 body->renderer()->setChildNeedsLayout(true);
988 } else if (body->hasTagName(bodyTag)) { 964 } else if (body->hasTagName(bodyTag)) {
989 if (!m_firstLayout && m_size.height() != layoutHeight() && b ody->renderer()->enclosingBox()->stretchesToViewport()) 965 if (!m_firstLayout && m_size.height() != layoutHeight() && b ody->renderer()->enclosingBox()->stretchesToViewport())
990 body->renderer()->setChildNeedsLayout(true); 966 body->renderer()->setChildNeedsLayout(true);
991 } 967 }
992 } 968 }
993 969
994 #ifdef INSTRUMENT_LAYOUT_SCHEDULING 970 #ifdef INSTRUMENT_LAYOUT_SCHEDULING
995 if (m_firstLayout && !m_frame->ownerElement()) 971 if (m_firstLayout && !m_frame->ownerElement())
996 printf("Elapsed time before first layout: %d\n", document->elaps edTime()); 972 printf("Elapsed time before first layout: %d\n", document->elaps edTime());
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 ASSERT(!root->needsLayout()); 1086 ASSERT(!root->needsLayout());
1111 1087
1112 updateCanBlitOnScrollRecursively(); 1088 updateCanBlitOnScrollRecursively();
1113 1089
1114 if (document->hasListenerType(Document::OVERFLOWCHANGED_LISTENER)) 1090 if (document->hasListenerType(Document::OVERFLOWCHANGED_LISTENER))
1115 updateOverflowStatus(layoutWidth() < contentsWidth(), 1091 updateOverflowStatus(layoutWidth() < contentsWidth(),
1116 layoutHeight() < contentsHeight()); 1092 layoutHeight() < contentsHeight());
1117 1093
1118 if (!m_postLayoutTasksTimer.isActive()) { 1094 if (!m_postLayoutTasksTimer.isActive()) {
1119 if (!m_inSynchronousPostLayout) { 1095 if (!m_inSynchronousPostLayout) {
1120 if (inChildFrameLayoutWithFrameFlattening) { 1096 m_inSynchronousPostLayout = true;
1121 if (RenderView* renderView = this->renderView()) 1097 // Calls resumeScheduledEvents()
1122 renderView->updateWidgetPositions(); 1098 performPostLayoutTasks();
1123 } else { 1099 m_inSynchronousPostLayout = false;
1124 m_inSynchronousPostLayout = true;
1125 // Calls resumeScheduledEvents()
1126 performPostLayoutTasks();
1127 m_inSynchronousPostLayout = false;
1128 }
1129 } 1100 }
1130 1101
1131 if (!m_postLayoutTasksTimer.isActive() && (needsLayout() || m_inSynchron ousPostLayout || inChildFrameLayoutWithFrameFlattening)) { 1102 if (!m_postLayoutTasksTimer.isActive() && (needsLayout() || m_inSynchron ousPostLayout || frame()->document()->shouldDisplaySeamlesslyWithParent())) {
1132 // If we need layout or are already in a synchronous call to postLay outTasks(), 1103 // If we need layout or are already in a synchronous call to postLay outTasks(),
1133 // defer widget updates and event dispatch until after we return. po stLayoutTasks() 1104 // defer widget updates and event dispatch until after we return. po stLayoutTasks()
1134 // can make us need to update again, and we can get stuck in a nasty cycle unless 1105 // can make us need to update again, and we can get stuck in a nasty cycle unless
1135 // we call it through the timer here. 1106 // we call it through the timer here.
1136 m_postLayoutTasksTimer.startOneShot(0); 1107 m_postLayoutTasksTimer.startOneShot(0);
1137 if (needsLayout()) { 1108 if (needsLayout()) {
1138 m_actionScheduler->pause(); 1109 m_actionScheduler->pause();
1139 layout(); 1110 layout();
1140 } 1111 }
1141 } 1112 }
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 m_layoutRoot->markContainingBlocksForLayout(false); 1898 m_layoutRoot->markContainingBlocksForLayout(false);
1928 m_layoutRoot = 0; 1899 m_layoutRoot = 0;
1929 } 1900 }
1930 if (!m_layoutSchedulingEnabled) 1901 if (!m_layoutSchedulingEnabled)
1931 return; 1902 return;
1932 if (!needsLayout()) 1903 if (!needsLayout())
1933 return; 1904 return;
1934 if (!m_frame->document()->shouldScheduleLayout()) 1905 if (!m_frame->document()->shouldScheduleLayout())
1935 return; 1906 return;
1936 InspectorInstrumentation::didInvalidateLayout(m_frame.get()); 1907 InspectorInstrumentation::didInvalidateLayout(m_frame.get());
1937 // When frame flattening is enabled, the contents of the frame could affect the layout of the parent frames. 1908
1909 // When frame seamless is enabled, the contents of the frame could affect th e layout of the parent frames.
1938 // Also invalidate parent frame starting from the owner element of this fram e. 1910 // Also invalidate parent frame starting from the owner element of this fram e.
1939 if (m_frame->ownerRenderer() && isInChildFrameWithFrameFlattening()) 1911 if (m_frame->ownerRenderer() && frame()->document()->shouldDisplaySeamlessly WithParent())
1940 m_frame->ownerRenderer()->setNeedsLayout(true, MarkContainingBlockChain) ; 1912 m_frame->ownerRenderer()->setNeedsLayout(true, MarkContainingBlockChain) ;
1941 1913
1942 int delay = m_frame->document()->minimumLayoutDelay(); 1914 int delay = m_frame->document()->minimumLayoutDelay();
1943 if (m_layoutTimer.isActive() && m_delayedLayout && !delay) 1915 if (m_layoutTimer.isActive() && m_delayedLayout && !delay)
1944 unscheduleRelayout(); 1916 unscheduleRelayout();
1945 if (m_layoutTimer.isActive()) 1917 if (m_layoutTimer.isActive())
1946 return; 1918 return;
1947 1919
1948 m_delayedLayout = delay != 0; 1920 m_delayedLayout = delay != 0;
1949 1921
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
2860 { 2832 {
2861 if (!parent()) 2833 if (!parent())
2862 return 0; 2834 return 0;
2863 2835
2864 if (Frame* parentFrame = m_frame->tree()->parent()) 2836 if (Frame* parentFrame = m_frame->tree()->parent())
2865 return parentFrame->view(); 2837 return parentFrame->view();
2866 2838
2867 return 0; 2839 return 0;
2868 } 2840 }
2869 2841
2870 bool FrameView::isInChildFrameWithFrameFlattening() const
2871 {
2872 if (!parent() || !m_frame->ownerElement())
2873 return false;
2874
2875 // Frame flattening applies when the owner element is either in a frameset o r
2876 // an iframe with flattening parameters.
2877 if (m_frame->ownerElement()->hasTagName(iframeTag)) {
2878 RenderIFrame* iframeRenderer = toRenderIFrame(m_frame->ownerElement()->r enderPart());
2879 if (iframeRenderer->flattenFrame() || iframeRenderer->isSeamless())
2880 return true;
2881 }
2882
2883 if (!m_frame->settings() || !m_frame->settings()->frameFlatteningEnabled())
2884 return false;
2885
2886 if (m_frame->ownerElement()->hasTagName(frameTag))
2887 return true;
2888
2889 return false;
2890 }
2891
2892 bool FrameView::doLayoutWithFrameFlattening(bool allowSubtree)
2893 {
2894 // Try initiating layout from the topmost parent.
2895 FrameView* parentView = parentFrameView();
2896
2897 if (!parentView)
2898 return false;
2899
2900 // In the middle of parent layout, no need to restart from topmost.
2901 if (parentView->m_nestedLayoutCount)
2902 return false;
2903
2904 // Parent tree is clean. Starting layout from it would have no effect.
2905 if (!parentView->needsLayout())
2906 return false;
2907
2908 while (parentView->parentFrameView())
2909 parentView = parentView->parentFrameView();
2910
2911 parentView->layout(allowSubtree);
2912
2913 RenderObject* root = m_layoutRoot ? m_layoutRoot : m_frame->document()->rend erer();
2914 ASSERT_UNUSED(root, !root->needsLayout());
2915
2916 return true;
2917 }
2918
2919 void FrameView::updateControlTints() 2842 void FrameView::updateControlTints()
2920 { 2843 {
2921 // This is called when control tints are changed from aqua/graphite to clear and vice versa. 2844 // This is called when control tints are changed from aqua/graphite to clear and vice versa.
2922 // We do a "fake" paint, and when the theme gets a paint call, it can then d o an invalidate. 2845 // We do a "fake" paint, and when the theme gets a paint call, it can then d o an invalidate.
2923 // This is only done if the theme supports control tinting. It's up to the t heme and platform 2846 // This is only done if the theme supports control tinting. It's up to the t heme and platform
2924 // to define when controls get the tint and to call this function when that changes. 2847 // to define when controls get the tint and to call this function when that changes.
2925 2848
2926 // Optimize the common case where we bring a window to the front while it's still empty. 2849 // Optimize the common case where we bring a window to the front while it's still empty.
2927 if (!m_frame || m_frame->document()->url().isEmpty()) 2850 if (!m_frame || m_frame->document()->url().isEmpty())
2928 return; 2851 return;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
3103 collectFrameViewChildren(this, frameViews); 3026 collectFrameViewChildren(this, frameViews);
3104 3027
3105 const Vector<RefPtr<FrameView> >::iterator end = frameViews.end(); 3028 const Vector<RefPtr<FrameView> >::iterator end = frameViews.end();
3106 for (Vector<RefPtr<FrameView> >::iterator it = frameViews.begin(); it != end ; ++it) 3029 for (Vector<RefPtr<FrameView> >::iterator it = frameViews.begin(); it != end ; ++it)
3107 (*it)->updateLayoutAndStyleIfNeededRecursive(); 3030 (*it)->updateLayoutAndStyleIfNeededRecursive();
3108 3031
3109 // updateLayoutAndStyleIfNeededRecursive is called when we need to make sure style and layout are up-to-date before 3032 // updateLayoutAndStyleIfNeededRecursive is called when we need to make sure style and layout are up-to-date before
3110 // painting, so we need to flush out any deferred repaints too. 3033 // painting, so we need to flush out any deferred repaints too.
3111 flushDeferredRepaints(); 3034 flushDeferredRepaints();
3112 3035
3113 // When frame flattening is on, child frame can mark parent frame dirty. In such case, child frame 3036 // When seamless is on, child frame can mark parent frame dirty. In such cas e, child frame
3114 // needs to call layout on parent frame recursively. 3037 // needs to call layout on parent frame recursively.
3115 // This assert ensures that parent frames are clean, when child frames finis hed updating layout and style. 3038 // This assert ensures that parent frames are clean, when child frames finis hed updating layout and style.
3116 ASSERT(!needsLayout()); 3039 ASSERT(!needsLayout());
3117 } 3040 }
3118 3041
3119 void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const In tSize& maxSize) 3042 void FrameView::enableAutoSizeMode(bool enable, const IntSize& minSize, const In tSize& maxSize)
3120 { 3043 {
3121 ASSERT(!enable || !minSize.isEmpty()); 3044 ASSERT(!enable || !minSize.isEmpty());
3122 ASSERT(minSize.width() <= maxSize.width()); 3045 ASSERT(minSize.width() <= maxSize.width());
3123 ASSERT(minSize.height() <= maxSize.height()); 3046 ASSERT(minSize.height() <= maxSize.height());
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
3485 } 3408 }
3486 3409
3487 AXObjectCache* FrameView::axObjectCache() const 3410 AXObjectCache* FrameView::axObjectCache() const
3488 { 3411 {
3489 if (frame() && frame()->document()) 3412 if (frame() && frame()->document())
3490 return frame()->document()->existingAXObjectCache(); 3413 return frame()->document()->existingAXObjectCache();
3491 return 0; 3414 return 0;
3492 } 3415 }
3493 3416
3494 } // namespace WebCore 3417 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/FrameView.h ('k') | Source/core/page/Settings.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698