OLD | NEW |
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 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 // If the embedded SVG document appears the first time, the ownerLayoutObjec
t has already finished | 782 // If the embedded SVG document appears the first time, the ownerLayoutObjec
t has already finished |
783 // layout without knowing about the existence of the embedded SVG document,
because LayoutReplaced | 783 // layout without knowing about the existence of the embedded SVG document,
because LayoutReplaced |
784 // embeddedContentBox() returns 0, as long as the embedded document isn't lo
aded yet. Before | 784 // embeddedContentBox() returns 0, as long as the embedded document isn't lo
aded yet. Before |
785 // bothering to lay out the SVG document, mark the ownerLayoutObject needing
layout and ask its | 785 // bothering to lay out the SVG document, mark the ownerLayoutObject needing
layout and ask its |
786 // FrameView for a layout. After that the LayoutEmbeddedObject (ownerLayoutO
bject) carries the | 786 // FrameView for a layout. After that the LayoutEmbeddedObject (ownerLayoutO
bject) carries the |
787 // correct size, which LayoutSVGRoot::computeReplacedLogicalWidth/Height rel
y on, when laying | 787 // correct size, which LayoutSVGRoot::computeReplacedLogicalWidth/Height rel
y on, when laying |
788 // out for the first time, or when the LayoutSVGRoot size has changed dynami
cally (eg. via <script>). | 788 // out for the first time, or when the LayoutSVGRoot size has changed dynami
cally (eg. via <script>). |
789 RefPtrWillBeRawPtr<FrameView> frameView = ownerLayoutObject->frame()->view()
; | 789 RefPtrWillBeRawPtr<FrameView> frameView = ownerLayoutObject->frame()->view()
; |
790 | 790 |
791 // Mark the owner renderer as needing layout. | 791 // Mark the owner renderer as needing layout. |
792 ownerLayoutObject->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation
(); | 792 ownerLayoutObject->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation
(LayoutInvalidationReason::Unknown); |
793 | 793 |
794 // Synchronously enter layout, to layout the view containing the host object
/embed/iframe. | 794 // Synchronously enter layout, to layout the view containing the host object
/embed/iframe. |
795 ASSERT(frameView); | 795 ASSERT(frameView); |
796 frameView->layout(); | 796 frameView->layout(); |
797 } | 797 } |
798 | 798 |
799 void FrameView::performPreLayoutTasks() | 799 void FrameView::performPreLayoutTasks() |
800 { | 800 { |
801 TRACE_EVENT0("blink,benchmark", "FrameView::performPreLayoutTasks"); | 801 TRACE_EVENT0("blink,benchmark", "FrameView::performPreLayoutTasks"); |
802 lifecycle().advanceTo(DocumentLifecycle::InPreLayout); | 802 lifecycle().advanceTo(DocumentLifecycle::InPreLayout); |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 && !m_frame->settings()->pinchVirtualViewportEnabled()) | 1310 && !m_frame->settings()->pinchVirtualViewportEnabled()) |
1311 return; | 1311 return; |
1312 | 1312 |
1313 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects)
{ | 1313 for (const auto& viewportConstrainedObject : *m_viewportConstrainedObjects)
{ |
1314 LayoutObject* renderer = viewportConstrainedObject; | 1314 LayoutObject* renderer = viewportConstrainedObject; |
1315 LayoutStyle* style = renderer->style(); | 1315 LayoutStyle* style = renderer->style(); |
1316 if (widthChanged) { | 1316 if (widthChanged) { |
1317 if (style->width().isFixed() && (style->left().isAuto() || style->ri
ght().isAuto())) | 1317 if (style->width().isFixed() && (style->left().isAuto() || style->ri
ght().isAuto())) |
1318 renderer->setNeedsPositionedMovementLayout(); | 1318 renderer->setNeedsPositionedMovementLayout(); |
1319 else | 1319 else |
1320 renderer->setNeedsLayoutAndFullPaintInvalidation(); | 1320 renderer->setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidat
ionReason::SizeChanged); |
1321 } | 1321 } |
1322 if (heightChanged) { | 1322 if (heightChanged) { |
1323 if (style->height().isFixed() && (style->top().isAuto() || style->bo
ttom().isAuto())) | 1323 if (style->height().isFixed() && (style->top().isAuto() || style->bo
ttom().isAuto())) |
1324 renderer->setNeedsPositionedMovementLayout(); | 1324 renderer->setNeedsPositionedMovementLayout(); |
1325 else | 1325 else |
1326 renderer->setNeedsLayoutAndFullPaintInvalidation(); | 1326 renderer->setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidat
ionReason::SizeChanged); |
1327 } | 1327 } |
1328 } | 1328 } |
1329 } | 1329 } |
1330 | 1330 |
1331 IntSize FrameView::scrollOffsetForViewportConstrainedObjects() const | 1331 IntSize FrameView::scrollOffsetForViewportConstrainedObjects() const |
1332 { | 1332 { |
1333 return roundedIntSize(viewportConstrainedVisibleContentRect().location()); | 1333 return roundedIntSize(viewportConstrainedVisibleContentRect().location()); |
1334 } | 1334 } |
1335 | 1335 |
1336 IntPoint FrameView::lastKnownMousePosition() const | 1336 IntPoint FrameView::lastKnownMousePosition() const |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1878 } | 1878 } |
1879 | 1879 |
1880 void FrameView::setNeedsLayout() | 1880 void FrameView::setNeedsLayout() |
1881 { | 1881 { |
1882 LayoutBox* box = embeddedContentBox(); | 1882 LayoutBox* box = embeddedContentBox(); |
1883 // It's illegal to ask for layout changes during the layout compositing or p
aint invalidation step. | 1883 // It's illegal to ask for layout changes during the layout compositing or p
aint invalidation step. |
1884 // FIXME: the third conditional is a hack to support embedded SVG. See Frame
View::forceLayoutParentViewIfNeeded and crbug.com/442939 | 1884 // FIXME: the third conditional is a hack to support embedded SVG. See Frame
View::forceLayoutParentViewIfNeeded and crbug.com/442939 |
1885 RELEASE_ASSERT(!m_frame->document() || m_frame->document()->lifecycle().stat
eAllowsLayoutInvalidation() || (box && box->isSVGRoot())); | 1885 RELEASE_ASSERT(!m_frame->document() || m_frame->document()->lifecycle().stat
eAllowsLayoutInvalidation() || (box && box->isSVGRoot())); |
1886 | 1886 |
1887 if (LayoutView* layoutView = this->layoutView()) | 1887 if (LayoutView* layoutView = this->layoutView()) |
1888 layoutView->setNeedsLayout(); | 1888 layoutView->setNeedsLayout(LayoutInvalidationReason::Unknown); |
1889 } | 1889 } |
1890 | 1890 |
1891 bool FrameView::isTransparent() const | 1891 bool FrameView::isTransparent() const |
1892 { | 1892 { |
1893 return m_isTransparent; | 1893 return m_isTransparent; |
1894 } | 1894 } |
1895 | 1895 |
1896 void FrameView::setTransparent(bool isTransparent) | 1896 void FrameView::setTransparent(bool isTransparent) |
1897 { | 1897 { |
1898 m_isTransparent = isTransparent; | 1898 m_isTransparent = isTransparent; |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2666 // Dumping externalRepresentation(m_frame->layoutObject()).ascii() is a good
trick to see | 2666 // Dumping externalRepresentation(m_frame->layoutObject()).ascii() is a good
trick to see |
2667 // the state of things before and after the layout | 2667 // the state of things before and after the layout |
2668 if (LayoutView* layoutView = this->layoutView()) { | 2668 if (LayoutView* layoutView = this->layoutView()) { |
2669 float pageLogicalWidth = layoutView->style()->isHorizontalWritingMode()
? pageSize.width() : pageSize.height(); | 2669 float pageLogicalWidth = layoutView->style()->isHorizontalWritingMode()
? pageSize.width() : pageSize.height(); |
2670 float pageLogicalHeight = layoutView->style()->isHorizontalWritingMode()
? pageSize.height() : pageSize.width(); | 2670 float pageLogicalHeight = layoutView->style()->isHorizontalWritingMode()
? pageSize.height() : pageSize.width(); |
2671 | 2671 |
2672 LayoutUnit flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogical
Width); | 2672 LayoutUnit flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogical
Width); |
2673 LayoutUnit flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogica
lHeight); | 2673 LayoutUnit flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogica
lHeight); |
2674 layoutView->setLogicalWidth(flooredPageLogicalWidth); | 2674 layoutView->setLogicalWidth(flooredPageLogicalWidth); |
2675 layoutView->setPageLogicalHeight(flooredPageLogicalHeight); | 2675 layoutView->setPageLogicalHeight(flooredPageLogicalHeight); |
2676 layoutView->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); | 2676 layoutView->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(La
youtInvalidationReason::PrintingChanged); |
2677 layout(); | 2677 layout(); |
2678 | 2678 |
2679 // If we don't fit in the given page width, we'll lay out again. If we d
on't fit in the | 2679 // If we don't fit in the given page width, we'll lay out again. If we d
on't fit in the |
2680 // page width when shrunk, we will lay out at maximum shrink and clip ex
tra content. | 2680 // page width when shrunk, we will lay out at maximum shrink and clip ex
tra content. |
2681 // FIXME: We are assuming a shrink-to-fit printing implementation. A cr
opping | 2681 // FIXME: We are assuming a shrink-to-fit printing implementation. A cr
opping |
2682 // implementation should not do this! | 2682 // implementation should not do this! |
2683 bool horizontalWritingMode = layoutView->style()->isHorizontalWritingMod
e(); | 2683 bool horizontalWritingMode = layoutView->style()->isHorizontalWritingMod
e(); |
2684 const LayoutRect& documentRect = LayoutRect(layoutView->documentRect()); | 2684 const LayoutRect& documentRect = LayoutRect(layoutView->documentRect()); |
2685 LayoutUnit docLogicalWidth = horizontalWritingMode ? documentRect.width(
) : documentRect.height(); | 2685 LayoutUnit docLogicalWidth = horizontalWritingMode ? documentRect.width(
) : documentRect.height(); |
2686 if (docLogicalWidth > pageLogicalWidth) { | 2686 if (docLogicalWidth > pageLogicalWidth) { |
2687 FloatSize expectedPageSize(std::min<float>(documentRect.width().toFl
oat(), pageSize.width() * maximumShrinkFactor), std::min<float>(documentRect.hei
ght().toFloat(), pageSize.height() * maximumShrinkFactor)); | 2687 FloatSize expectedPageSize(std::min<float>(documentRect.width().toFl
oat(), pageSize.width() * maximumShrinkFactor), std::min<float>(documentRect.hei
ght().toFloat(), pageSize.height() * maximumShrinkFactor)); |
2688 FloatSize maxPageSize = m_frame->resizePageRectsKeepingRatio(FloatSi
ze(originalPageSize.width(), originalPageSize.height()), expectedPageSize); | 2688 FloatSize maxPageSize = m_frame->resizePageRectsKeepingRatio(FloatSi
ze(originalPageSize.width(), originalPageSize.height()), expectedPageSize); |
2689 pageLogicalWidth = horizontalWritingMode ? maxPageSize.width() : max
PageSize.height(); | 2689 pageLogicalWidth = horizontalWritingMode ? maxPageSize.width() : max
PageSize.height(); |
2690 pageLogicalHeight = horizontalWritingMode ? maxPageSize.height() : m
axPageSize.width(); | 2690 pageLogicalHeight = horizontalWritingMode ? maxPageSize.height() : m
axPageSize.width(); |
2691 | 2691 |
2692 flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogicalWidth); | 2692 flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogicalWidth); |
2693 flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogicalHeight
); | 2693 flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogicalHeight
); |
2694 layoutView->setLogicalWidth(flooredPageLogicalWidth); | 2694 layoutView->setLogicalWidth(flooredPageLogicalWidth); |
2695 layoutView->setPageLogicalHeight(flooredPageLogicalHeight); | 2695 layoutView->setPageLogicalHeight(flooredPageLogicalHeight); |
2696 layoutView->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidatio
n(); | 2696 layoutView->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidatio
n(LayoutInvalidationReason::PrintingChanged); |
2697 layout(); | 2697 layout(); |
2698 | 2698 |
2699 const LayoutRect& updatedDocumentRect = LayoutRect(layoutView->docum
entRect()); | 2699 const LayoutRect& updatedDocumentRect = LayoutRect(layoutView->docum
entRect()); |
2700 LayoutUnit docLogicalHeight = horizontalWritingMode ? updatedDocumen
tRect.height() : updatedDocumentRect.width(); | 2700 LayoutUnit docLogicalHeight = horizontalWritingMode ? updatedDocumen
tRect.height() : updatedDocumentRect.width(); |
2701 LayoutUnit docLogicalTop = horizontalWritingMode ? updatedDocumentRe
ct.y() : updatedDocumentRect.x(); | 2701 LayoutUnit docLogicalTop = horizontalWritingMode ? updatedDocumentRe
ct.y() : updatedDocumentRect.x(); |
2702 LayoutUnit docLogicalRight = horizontalWritingMode ? updatedDocument
Rect.maxX() : updatedDocumentRect.maxY(); | 2702 LayoutUnit docLogicalRight = horizontalWritingMode ? updatedDocument
Rect.maxX() : updatedDocumentRect.maxY(); |
2703 LayoutUnit clippedLogicalLeft = 0; | 2703 LayoutUnit clippedLogicalLeft = 0; |
2704 if (!layoutView->style()->isLeftToRightDirection()) | 2704 if (!layoutView->style()->isLeftToRightDirection()) |
2705 clippedLogicalLeft = docLogicalRight - pageLogicalWidth; | 2705 clippedLogicalLeft = docLogicalRight - pageLogicalWidth; |
2706 LayoutRect overflow(clippedLogicalLeft, docLogicalTop, pageLogicalWi
dth, docLogicalHeight); | 2706 LayoutRect overflow(clippedLogicalLeft, docLogicalTop, pageLogicalWi
dth, docLogicalHeight); |
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4067 { | 4067 { |
4068 Settings* settings = frame().settings(); | 4068 Settings* settings = frame().settings(); |
4069 if (!settings || !settings->rootLayerScrolls()) | 4069 if (!settings || !settings->rootLayerScrolls()) |
4070 return this; | 4070 return this; |
4071 | 4071 |
4072 LayoutView* layoutView = this->layoutView(); | 4072 LayoutView* layoutView = this->layoutView(); |
4073 return layoutView ? layoutView->scrollableArea() : nullptr; | 4073 return layoutView ? layoutView->scrollableArea() : nullptr; |
4074 } | 4074 } |
4075 | 4075 |
4076 } // namespace blink | 4076 } // namespace blink |
OLD | NEW |