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