| 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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 // If the embedded SVG document appears the first time, the ownerRenderer ha
s already finished | 732 // If the embedded SVG document appears the first time, the ownerRenderer ha
s already finished |
| 733 // layout without knowing about the existence of the embedded SVG document,
because RenderReplaced | 733 // layout without knowing about the existence of the embedded SVG document,
because RenderReplaced |
| 734 // embeddedContentBox() returns 0, as long as the embedded document isn't lo
aded yet. Before | 734 // embeddedContentBox() returns 0, as long as the embedded document isn't lo
aded yet. Before |
| 735 // bothering to lay out the SVG document, mark the ownerRenderer needing lay
out and ask its | 735 // bothering to lay out the SVG document, mark the ownerRenderer needing lay
out and ask its |
| 736 // FrameView for a layout. After that the RenderEmbeddedObject (ownerRendere
r) carries the | 736 // FrameView for a layout. After that the RenderEmbeddedObject (ownerRendere
r) carries the |
| 737 // correct size, which RenderSVGRoot::computeReplacedLogicalWidth/Height rel
y on, when laying | 737 // correct size, which RenderSVGRoot::computeReplacedLogicalWidth/Height rel
y on, when laying |
| 738 // out for the first time, or when the RenderSVGRoot size has changed dynami
cally (eg. via <script>). | 738 // out for the first time, or when the RenderSVGRoot size has changed dynami
cally (eg. via <script>). |
| 739 RefPtr<FrameView> frameView = ownerRenderer->frame()->view(); | 739 RefPtr<FrameView> frameView = ownerRenderer->frame()->view(); |
| 740 | 740 |
| 741 // Mark the owner renderer as needing layout. | 741 // Mark the owner renderer as needing layout. |
| 742 ownerRenderer->setNeedsLayoutAndPrefWidthsRecalc(); | 742 ownerRenderer->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
| 743 | 743 |
| 744 // Synchronously enter layout, to layout the view containing the host object
/embed/iframe. | 744 // Synchronously enter layout, to layout the view containing the host object
/embed/iframe. |
| 745 ASSERT(frameView); | 745 ASSERT(frameView); |
| 746 frameView->layout(); | 746 frameView->layout(); |
| 747 } | 747 } |
| 748 | 748 |
| 749 void FrameView::performPreLayoutTasks() | 749 void FrameView::performPreLayoutTasks() |
| 750 { | 750 { |
| 751 TRACE_EVENT0("webkit", "FrameView::performPreLayoutTasks"); | 751 TRACE_EVENT0("webkit", "FrameView::performPreLayoutTasks"); |
| 752 lifecycle().advanceTo(DocumentLifecycle::InPreLayout); | 752 lifecycle().advanceTo(DocumentLifecycle::InPreLayout); |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1302 return; | 1302 return; |
| 1303 | 1303 |
| 1304 ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObje
cts->end(); | 1304 ViewportConstrainedObjectSet::const_iterator end = m_viewportConstrainedObje
cts->end(); |
| 1305 for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrained
Objects->begin(); it != end; ++it) { | 1305 for (ViewportConstrainedObjectSet::const_iterator it = m_viewportConstrained
Objects->begin(); it != end; ++it) { |
| 1306 RenderObject* renderer = *it; | 1306 RenderObject* renderer = *it; |
| 1307 RenderStyle* style = renderer->style(); | 1307 RenderStyle* style = renderer->style(); |
| 1308 if (widthChanged) { | 1308 if (widthChanged) { |
| 1309 if (style->width().isFixed() && (style->left().isAuto() || style->ri
ght().isAuto())) | 1309 if (style->width().isFixed() && (style->left().isAuto() || style->ri
ght().isAuto())) |
| 1310 renderer->setNeedsPositionedMovementLayout(); | 1310 renderer->setNeedsPositionedMovementLayout(); |
| 1311 else | 1311 else |
| 1312 renderer->setNeedsLayout(); | 1312 renderer->setNeedsLayoutAndFullRepaint(); |
| 1313 } | 1313 } |
| 1314 if (heightChanged) { | 1314 if (heightChanged) { |
| 1315 if (style->height().isFixed() && (style->top().isAuto() || style->bo
ttom().isAuto())) | 1315 if (style->height().isFixed() && (style->top().isAuto() || style->bo
ttom().isAuto())) |
| 1316 renderer->setNeedsPositionedMovementLayout(); | 1316 renderer->setNeedsPositionedMovementLayout(); |
| 1317 else | 1317 else |
| 1318 renderer->setNeedsLayout(); | 1318 renderer->setNeedsLayoutAndFullRepaint(); |
| 1319 } | 1319 } |
| 1320 } | 1320 } |
| 1321 } | 1321 } |
| 1322 | 1322 |
| 1323 bool FrameView::shouldPlaceVerticalScrollbarOnLeft() const | 1323 bool FrameView::shouldPlaceVerticalScrollbarOnLeft() const |
| 1324 { | 1324 { |
| 1325 // FIXME: Mainframe scrollbar placement should respect the embedding applica
tion RTL UI policy. | 1325 // FIXME: Mainframe scrollbar placement should respect the embedding applica
tion RTL UI policy. |
| 1326 // See crbug.com/249860. | 1326 // See crbug.com/249860. |
| 1327 if (m_frame->isMainFrame()) | 1327 if (m_frame->isMainFrame()) |
| 1328 return false; | 1328 return false; |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1921 | 1921 |
| 1922 RenderView* renderView = this->renderView(); | 1922 RenderView* renderView = this->renderView(); |
| 1923 return layoutPending() | 1923 return layoutPending() |
| 1924 || (renderView && renderView->needsLayout()) | 1924 || (renderView && renderView->needsLayout()) |
| 1925 || isSubtreeLayout(); | 1925 || isSubtreeLayout(); |
| 1926 } | 1926 } |
| 1927 | 1927 |
| 1928 void FrameView::setNeedsLayout() | 1928 void FrameView::setNeedsLayout() |
| 1929 { | 1929 { |
| 1930 if (RenderView* renderView = this->renderView()) | 1930 if (RenderView* renderView = this->renderView()) |
| 1931 renderView->setNeedsLayout(); | 1931 renderView->setNeedsLayoutAndFullRepaint(); |
| 1932 } | 1932 } |
| 1933 | 1933 |
| 1934 bool FrameView::isTransparent() const | 1934 bool FrameView::isTransparent() const |
| 1935 { | 1935 { |
| 1936 return m_isTransparent; | 1936 return m_isTransparent; |
| 1937 } | 1937 } |
| 1938 | 1938 |
| 1939 void FrameView::setTransparent(bool isTransparent) | 1939 void FrameView::setTransparent(bool isTransparent) |
| 1940 { | 1940 { |
| 1941 m_isTransparent = isTransparent; | 1941 m_isTransparent = isTransparent; |
| (...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2934 // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good tri
ck to see | 2934 // Dumping externalRepresentation(m_frame->renderer()).ascii() is a good tri
ck to see |
| 2935 // the state of things before and after the layout | 2935 // the state of things before and after the layout |
| 2936 if (RenderView* renderView = this->renderView()) { | 2936 if (RenderView* renderView = this->renderView()) { |
| 2937 float pageLogicalWidth = renderView->style()->isHorizontalWritingMode()
? pageSize.width() : pageSize.height(); | 2937 float pageLogicalWidth = renderView->style()->isHorizontalWritingMode()
? pageSize.width() : pageSize.height(); |
| 2938 float pageLogicalHeight = renderView->style()->isHorizontalWritingMode()
? pageSize.height() : pageSize.width(); | 2938 float pageLogicalHeight = renderView->style()->isHorizontalWritingMode()
? pageSize.height() : pageSize.width(); |
| 2939 | 2939 |
| 2940 LayoutUnit flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogical
Width); | 2940 LayoutUnit flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogical
Width); |
| 2941 LayoutUnit flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogica
lHeight); | 2941 LayoutUnit flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogica
lHeight); |
| 2942 renderView->setLogicalWidth(flooredPageLogicalWidth); | 2942 renderView->setLogicalWidth(flooredPageLogicalWidth); |
| 2943 renderView->setPageLogicalHeight(flooredPageLogicalHeight); | 2943 renderView->setPageLogicalHeight(flooredPageLogicalHeight); |
| 2944 renderView->setNeedsLayoutAndPrefWidthsRecalc(); | 2944 renderView->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
| 2945 forceLayout(); | 2945 forceLayout(); |
| 2946 | 2946 |
| 2947 // If we don't fit in the given page width, we'll lay out again. If we d
on't fit in the | 2947 // If we don't fit in the given page width, we'll lay out again. If we d
on't fit in the |
| 2948 // page width when shrunk, we will lay out at maximum shrink and clip ex
tra content. | 2948 // page width when shrunk, we will lay out at maximum shrink and clip ex
tra content. |
| 2949 // FIXME: We are assuming a shrink-to-fit printing implementation. A cr
opping | 2949 // FIXME: We are assuming a shrink-to-fit printing implementation. A cr
opping |
| 2950 // implementation should not do this! | 2950 // implementation should not do this! |
| 2951 bool horizontalWritingMode = renderView->style()->isHorizontalWritingMod
e(); | 2951 bool horizontalWritingMode = renderView->style()->isHorizontalWritingMod
e(); |
| 2952 const LayoutRect& documentRect = renderView->documentRect(); | 2952 const LayoutRect& documentRect = renderView->documentRect(); |
| 2953 LayoutUnit docLogicalWidth = horizontalWritingMode ? documentRect.width(
) : documentRect.height(); | 2953 LayoutUnit docLogicalWidth = horizontalWritingMode ? documentRect.width(
) : documentRect.height(); |
| 2954 if (docLogicalWidth > pageLogicalWidth) { | 2954 if (docLogicalWidth > pageLogicalWidth) { |
| 2955 FloatSize expectedPageSize(std::min<float>(documentRect.width().toFl
oat(), pageSize.width() * maximumShrinkFactor), std::min<float>(documentRect.hei
ght().toFloat(), pageSize.height() * maximumShrinkFactor)); | 2955 FloatSize expectedPageSize(std::min<float>(documentRect.width().toFl
oat(), pageSize.width() * maximumShrinkFactor), std::min<float>(documentRect.hei
ght().toFloat(), pageSize.height() * maximumShrinkFactor)); |
| 2956 FloatSize maxPageSize = m_frame->resizePageRectsKeepingRatio(FloatSi
ze(originalPageSize.width(), originalPageSize.height()), expectedPageSize); | 2956 FloatSize maxPageSize = m_frame->resizePageRectsKeepingRatio(FloatSi
ze(originalPageSize.width(), originalPageSize.height()), expectedPageSize); |
| 2957 pageLogicalWidth = horizontalWritingMode ? maxPageSize.width() : max
PageSize.height(); | 2957 pageLogicalWidth = horizontalWritingMode ? maxPageSize.width() : max
PageSize.height(); |
| 2958 pageLogicalHeight = horizontalWritingMode ? maxPageSize.height() : m
axPageSize.width(); | 2958 pageLogicalHeight = horizontalWritingMode ? maxPageSize.height() : m
axPageSize.width(); |
| 2959 | 2959 |
| 2960 flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogicalWidth); | 2960 flooredPageLogicalWidth = static_cast<LayoutUnit>(pageLogicalWidth); |
| 2961 flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogicalHeight
); | 2961 flooredPageLogicalHeight = static_cast<LayoutUnit>(pageLogicalHeight
); |
| 2962 renderView->setLogicalWidth(flooredPageLogicalWidth); | 2962 renderView->setLogicalWidth(flooredPageLogicalWidth); |
| 2963 renderView->setPageLogicalHeight(flooredPageLogicalHeight); | 2963 renderView->setPageLogicalHeight(flooredPageLogicalHeight); |
| 2964 renderView->setNeedsLayoutAndPrefWidthsRecalc(); | 2964 renderView->setNeedsLayoutAndPrefWidthsRecalcAndFullRepaint(); |
| 2965 forceLayout(); | 2965 forceLayout(); |
| 2966 | 2966 |
| 2967 const LayoutRect& updatedDocumentRect = renderView->documentRect(); | 2967 const LayoutRect& updatedDocumentRect = renderView->documentRect(); |
| 2968 LayoutUnit docLogicalHeight = horizontalWritingMode ? updatedDocumen
tRect.height() : updatedDocumentRect.width(); | 2968 LayoutUnit docLogicalHeight = horizontalWritingMode ? updatedDocumen
tRect.height() : updatedDocumentRect.width(); |
| 2969 LayoutUnit docLogicalTop = horizontalWritingMode ? updatedDocumentRe
ct.y() : updatedDocumentRect.x(); | 2969 LayoutUnit docLogicalTop = horizontalWritingMode ? updatedDocumentRe
ct.y() : updatedDocumentRect.x(); |
| 2970 LayoutUnit docLogicalRight = horizontalWritingMode ? updatedDocument
Rect.maxX() : updatedDocumentRect.maxY(); | 2970 LayoutUnit docLogicalRight = horizontalWritingMode ? updatedDocument
Rect.maxX() : updatedDocumentRect.maxY(); |
| 2971 LayoutUnit clippedLogicalLeft = 0; | 2971 LayoutUnit clippedLogicalLeft = 0; |
| 2972 if (!renderView->style()->isLeftToRightDirection()) | 2972 if (!renderView->style()->isLeftToRightDirection()) |
| 2973 clippedLogicalLeft = docLogicalRight - pageLogicalWidth; | 2973 clippedLogicalLeft = docLogicalRight - pageLogicalWidth; |
| 2974 LayoutRect overflow(clippedLogicalLeft, docLogicalTop, pageLogicalWi
dth, docLogicalHeight); | 2974 LayoutRect overflow(clippedLogicalLeft, docLogicalTop, pageLogicalWi
dth, docLogicalHeight); |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3279 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) | 3279 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o
rientation) |
| 3280 { | 3280 { |
| 3281 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); | 3281 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); |
| 3282 if (AXObjectCache* cache = axObjectCache()) { | 3282 if (AXObjectCache* cache = axObjectCache()) { |
| 3283 cache->remove(scrollbar); | 3283 cache->remove(scrollbar); |
| 3284 cache->handleScrollbarUpdate(this); | 3284 cache->handleScrollbarUpdate(this); |
| 3285 } | 3285 } |
| 3286 } | 3286 } |
| 3287 | 3287 |
| 3288 } // namespace WebCore | 3288 } // namespace WebCore |
| OLD | NEW |