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

Side by Side Diff: Source/core/layout/LayoutBox.cpp

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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/layout/LayoutBlockFlowLine.cpp ('k') | Source/core/layout/LayoutCounter.cpp » ('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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // Size of border belt for autoscroll. When mouse pointer in border belt, 84 // Size of border belt for autoscroll. When mouse pointer in border belt,
85 // autoscroll is started. 85 // autoscroll is started.
86 static const int autoscrollBeltSize = 20; 86 static const int autoscrollBeltSize = 20;
87 static const unsigned backgroundObscurationTestMaxDepth = 4; 87 static const unsigned backgroundObscurationTestMaxDepth = 4;
88 88
89 static bool skipBodyBackground(const LayoutBox* bodyElementRenderer) 89 static bool skipBodyBackground(const LayoutBox* bodyElementRenderer)
90 { 90 {
91 ASSERT(bodyElementRenderer->isBody()); 91 ASSERT(bodyElementRenderer->isBody());
92 // The <body> only paints its background if the root element has defined a b ackground independent of the body, 92 // The <body> only paints its background if the root element has defined a b ackground independent of the body,
93 // or if the <body>'s parent is not the document element's renderer (e.g. in side SVG foreignObject). 93 // or if the <body>'s parent is not the document element's renderer (e.g. in side SVG foreignObject).
94 LayoutObject* documentElementRenderer = bodyElementRenderer->document().docu mentElement()->renderer(); 94 LayoutObject* documentElementRenderer = bodyElementRenderer->document().docu mentElement()->layoutObject();
95 return documentElementRenderer 95 return documentElementRenderer
96 && !documentElementRenderer->hasBackground() 96 && !documentElementRenderer->hasBackground()
97 && (documentElementRenderer == bodyElementRenderer->parent()); 97 && (documentElementRenderer == bodyElementRenderer->parent());
98 } 98 }
99 99
100 LayoutBox::LayoutBox(ContainerNode* node) 100 LayoutBox::LayoutBox(ContainerNode* node)
101 : LayoutBoxModelObject(node) 101 : LayoutBoxModelObject(node)
102 , m_intrinsicContentLogicalHeight(-1) 102 , m_intrinsicContentLogicalHeight(-1)
103 , m_minPreferredLogicalWidth(-1) 103 , m_minPreferredLogicalWidth(-1)
104 , m_maxPreferredLogicalWidth(-1) 104 , m_maxPreferredLogicalWidth(-1)
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 } 489 }
490 490
491 if (hasOverflowClip() && !restrictedByLineClamp) { 491 if (hasOverflowClip() && !restrictedByLineClamp) {
492 // Don't scroll to reveal an overflow layer that is restricted by the -w ebkit-line-clamp property. 492 // Don't scroll to reveal an overflow layer that is restricted by the -w ebkit-line-clamp property.
493 // This will prevent us from revealing text hidden by the slider in Safa ri RSS. 493 // This will prevent us from revealing text hidden by the slider in Safa ri RSS.
494 newRect = layer()->scrollableArea()->exposeRect(rect, alignX, alignY); 494 newRect = layer()->scrollableArea()->exposeRect(rect, alignX, alignY);
495 } else if (!parentBox && canBeProgramaticallyScrolled()) { 495 } else if (!parentBox && canBeProgramaticallyScrolled()) {
496 if (FrameView* frameView = this->frameView()) { 496 if (FrameView* frameView = this->frameView()) {
497 HTMLFrameOwnerElement* ownerElement = document().ownerElement(); 497 HTMLFrameOwnerElement* ownerElement = document().ownerElement();
498 498
499 if (ownerElement && ownerElement->renderer()) { 499 if (ownerElement && ownerElement->layoutObject()) {
500 HTMLFrameElementBase* frameElementBase = isHTMLFrameElementBase( *ownerElement) ? toHTMLFrameElementBase(ownerElement) : 0; 500 HTMLFrameElementBase* frameElementBase = isHTMLFrameElementBase( *ownerElement) ? toHTMLFrameElementBase(ownerElement) : 0;
501 if (frameElementAndViewPermitScroll(frameElementBase, frameView) ) { 501 if (frameElementAndViewPermitScroll(frameElementBase, frameView) ) {
502 LayoutRect viewRect(frameView->visibleContentRect()); 502 LayoutRect viewRect(frameView->visibleContentRect());
503 LayoutRect exposeRect = ScrollAlignment::getRectToExpose(vie wRect, rect, alignX, alignY); 503 LayoutRect exposeRect = ScrollAlignment::getRectToExpose(vie wRect, rect, alignX, alignY);
504 504
505 double xOffset = exposeRect.x(); 505 double xOffset = exposeRect.x();
506 double yOffset = exposeRect.y(); 506 double yOffset = exposeRect.y();
507 // Adjust offsets if they're outside of the allowable range. 507 // Adjust offsets if they're outside of the allowable range.
508 xOffset = std::max(0.0, std::min<double>(frameView->contents Width(), xOffset)); 508 xOffset = std::max(0.0, std::min<double>(frameView->contents Width(), xOffset));
509 yOffset = std::max(0.0, std::min<double>(frameView->contents Height(), yOffset)); 509 yOffset = std::max(0.0, std::min<double>(frameView->contents Height(), yOffset));
510 510
511 frameView->setScrollPosition(DoublePoint(xOffset, yOffset)); 511 frameView->setScrollPosition(DoublePoint(xOffset, yOffset));
512 if (frameView->safeToPropagateScrollToParent()) { 512 if (frameView->safeToPropagateScrollToParent()) {
513 parentBox = ownerElement->renderer()->enclosingBox(); 513 parentBox = ownerElement->layoutObject()->enclosingBox() ;
514 // FIXME: This doesn't correctly convert the rect to 514 // FIXME: This doesn't correctly convert the rect to
515 // absolute coordinates in the parent. 515 // absolute coordinates in the parent.
516 newRect.setX(rect.x() - frameView->scrollX() + frameView ->x()); 516 newRect.setX(rect.x() - frameView->scrollX() + frameView ->x());
517 newRect.setY(rect.y() - frameView->scrollY() + frameView ->y()); 517 newRect.setY(rect.y() - frameView->scrollY() + frameView ->y());
518 } else { 518 } else {
519 parentBox = 0; 519 parentBox = 0;
520 } 520 }
521 } 521 }
522 } else { 522 } else {
523 if (frame()->settings()->pinchVirtualViewportEnabled()) { 523 if (frame()->settings()->pinchVirtualViewportEnabled()) {
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 else if (windowAutoscrollPoint.y() > windowBox.maxY() - autoscrollBeltSize) 820 else if (windowAutoscrollPoint.y() > windowBox.maxY() - autoscrollBeltSize)
821 windowAutoscrollPoint.move(0, autoscrollBeltSize); 821 windowAutoscrollPoint.move(0, autoscrollBeltSize);
822 822
823 return windowAutoscrollPoint - windowPoint; 823 return windowAutoscrollPoint - windowPoint;
824 } 824 }
825 825
826 LayoutBox* LayoutBox::findAutoscrollable(LayoutObject* renderer) 826 LayoutBox* LayoutBox::findAutoscrollable(LayoutObject* renderer)
827 { 827 {
828 while (renderer && !(renderer->isBox() && toLayoutBox(renderer)->canAutoscro ll())) { 828 while (renderer && !(renderer->isBox() && toLayoutBox(renderer)->canAutoscro ll())) {
829 if (!renderer->parent() && renderer->node() == renderer->document() && r enderer->document().ownerElement()) 829 if (!renderer->parent() && renderer->node() == renderer->document() && r enderer->document().ownerElement())
830 renderer = renderer->document().ownerElement()->renderer(); 830 renderer = renderer->document().ownerElement()->layoutObject();
831 else 831 else
832 renderer = renderer->parent(); 832 renderer = renderer->parent();
833 } 833 }
834 834
835 return renderer && renderer->isBox() ? toLayoutBox(renderer) : 0; 835 return renderer && renderer->isBox() ? toLayoutBox(renderer) : 0;
836 } 836 }
837 837
838 static inline int adjustedScrollDelta(int beginningDelta) 838 static inline int adjustedScrollDelta(int beginningDelta)
839 { 839 {
840 // This implemention matches Firefox's. 840 // This implemention matches Firefox's.
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 paintInvalidationLayerRectsForImage(image, style()->maskLayers(), false) ; 1374 paintInvalidationLayerRectsForImage(image, style()->maskLayers(), false) ;
1375 } 1375 }
1376 1376
1377 bool LayoutBox::paintInvalidationLayerRectsForImage(WrappedImagePtr image, const FillLayer& layers, bool drawingBackground) 1377 bool LayoutBox::paintInvalidationLayerRectsForImage(WrappedImagePtr image, const FillLayer& layers, bool drawingBackground)
1378 { 1378 {
1379 Vector<LayoutObject*> layerRenderers; 1379 Vector<LayoutObject*> layerRenderers;
1380 1380
1381 // A background of the body or document must extend to the total visible siz e of the document. This means the union of the 1381 // A background of the body or document must extend to the total visible siz e of the document. This means the union of the
1382 // view and document bounds, since it can be the case that the view is large r than the document and vice-versa. 1382 // view and document bounds, since it can be the case that the view is large r than the document and vice-versa.
1383 // http://dev.w3.org/csswg/css-backgrounds/#the-background 1383 // http://dev.w3.org/csswg/css-backgrounds/#the-background
1384 if (drawingBackground && (isDocumentElement() || (isBody() && !document().do cumentElement()->renderer()->hasBackground()))) { 1384 if (drawingBackground && (isDocumentElement() || (isBody() && !document().do cumentElement()->layoutObject()->hasBackground()))) {
1385 layerRenderers.append(document().documentElement()->renderer()); 1385 layerRenderers.append(document().documentElement()->layoutObject());
1386 layerRenderers.append(view()); 1386 layerRenderers.append(view());
1387 if (view()->frameView()) 1387 if (view()->frameView())
1388 view()->frameView()->setNeedsFullPaintInvalidation(); 1388 view()->frameView()->setNeedsFullPaintInvalidation();
1389 } else { 1389 } else {
1390 layerRenderers.append(this); 1390 layerRenderers.append(this);
1391 } 1391 }
1392 for (const FillLayer* curLayer = &layers; curLayer; curLayer = curLayer->nex t()) { 1392 for (const FillLayer* curLayer = &layers; curLayer; curLayer = curLayer->nex t()) {
1393 if (curLayer->image() && image == curLayer->image()->data() && curLayer- >image()->canRender(*this, style()->effectiveZoom())) { 1393 if (curLayer->image() && image == curLayer->image()->data() && curLayer- >image()->canRender(*this, style()->effectiveZoom())) {
1394 for (LayoutObject* layerRenderer : layerRenderers) 1394 for (LayoutObject* layerRenderer : layerRenderers)
1395 layerRenderer->setShouldDoFullPaintInvalidation(); 1395 layerRenderer->setShouldDoFullPaintInvalidation();
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
2346 computeMarginsForDirection(flowDirection, cb, containingBlockLogicalWidt hForContent(), computedValues.m_extent, computedValues.m_margins.m_before, 2346 computeMarginsForDirection(flowDirection, cb, containingBlockLogicalWidt hForContent(), computedValues.m_extent, computedValues.m_margins.m_before,
2347 computedValues.m_margins.m_after, style()->marginBefore(), style()-> marginAfter()); 2347 computedValues.m_margins.m_after, style()->marginBefore(), style()-> marginAfter());
2348 } 2348 }
2349 2349
2350 // WinIE quirk: The <html> block always fills the entire canvas in quirks mo de. The <body> always fills the 2350 // WinIE quirk: The <html> block always fills the entire canvas in quirks mo de. The <body> always fills the
2351 // <html> block in quirks mode. Only apply this quirk if the block is norma l flow and no height 2351 // <html> block in quirks mode. Only apply this quirk if the block is norma l flow and no height
2352 // is specified. When we're printing, we also need this quirk if the body or root has a percentage 2352 // is specified. When we're printing, we also need this quirk if the body or root has a percentage
2353 // height since we don't set a height in LayoutView when we're printing. So without this quirk, the 2353 // height since we don't set a height in LayoutView when we're printing. So without this quirk, the
2354 // height has nothing to be a percentage of, and it ends up being 0. That is bad. 2354 // height has nothing to be a percentage of, and it ends up being 0. That is bad.
2355 bool paginatedContentNeedsBaseHeight = document().printing() && h.isPercent( ) 2355 bool paginatedContentNeedsBaseHeight = document().printing() && h.isPercent( )
2356 && (isDocumentElement() || (isBody() && document().documentElement()->re nderer()->style()->logicalHeight().isPercent())) && !isInline(); 2356 && (isDocumentElement() || (isBody() && document().documentElement()->la youtObject()->style()->logicalHeight().isPercent())) && !isInline();
2357 if (stretchesToViewport() || paginatedContentNeedsBaseHeight) { 2357 if (stretchesToViewport() || paginatedContentNeedsBaseHeight) {
2358 LayoutUnit margins = collapsedMarginBefore() + collapsedMarginAfter(); 2358 LayoutUnit margins = collapsedMarginBefore() + collapsedMarginAfter();
2359 LayoutUnit visibleHeight = view()->viewLogicalHeightForPercentages(); 2359 LayoutUnit visibleHeight = view()->viewLogicalHeightForPercentages();
2360 if (isDocumentElement()) { 2360 if (isDocumentElement()) {
2361 computedValues.m_extent = std::max(computedValues.m_extent, visibleH eight - margins); 2361 computedValues.m_extent = std::max(computedValues.m_extent, visibleH eight - margins);
2362 } else { 2362 } else {
2363 LayoutUnit marginsBordersPadding = margins + parentBox()->marginBefo re() + parentBox()->marginAfter() + parentBox()->borderAndPaddingLogicalHeight() ; 2363 LayoutUnit marginsBordersPadding = margins + parentBox()->marginBefo re() + parentBox()->marginAfter() + parentBox()->borderAndPaddingLogicalHeight() ;
2364 computedValues.m_extent = std::max(computedValues.m_extent, visibleH eight - marginsBordersPadding); 2364 computedValues.m_extent = std::max(computedValues.m_extent, visibleH eight - marginsBordersPadding);
2365 } 2365 }
2366 } 2366 }
(...skipping 2277 matching lines...) Expand 10 before | Expand all | Expand 10 after
4644 computedValues.m_margins.m_end = marginEnd(); 4644 computedValues.m_margins.m_end = marginEnd();
4645 4645
4646 setLogicalTop(oldLogicalTop); 4646 setLogicalTop(oldLogicalTop);
4647 setLogicalWidth(oldLogicalWidth); 4647 setLogicalWidth(oldLogicalWidth);
4648 setLogicalLeft(oldLogicalLeft); 4648 setLogicalLeft(oldLogicalLeft);
4649 setMarginLeft(oldMarginLeft); 4649 setMarginLeft(oldMarginLeft);
4650 setMarginRight(oldMarginRight); 4650 setMarginRight(oldMarginRight);
4651 } 4651 }
4652 4652
4653 } // namespace blink 4653 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBlockFlowLine.cpp ('k') | Source/core/layout/LayoutCounter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698