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

Side by Side Diff: Source/core/rendering/RenderBoxModelObject.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 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
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 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 bool RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight() const 208 bool RenderBoxModelObject::hasAutoHeightOrContainingBlockWithAutoHeight() const
209 { 209 {
210 Length logicalHeightLength = style()->logicalHeight(); 210 Length logicalHeightLength = style()->logicalHeight();
211 if (logicalHeightLength.isAuto()) 211 if (logicalHeightLength.isAuto())
212 return true; 212 return true;
213 213
214 // For percentage heights: The percentage is calculated with respect to the height of the generated box's 214 // For percentage heights: The percentage is calculated with respect to the height of the generated box's
215 // containing block. If the height of the containing block is not specified explicitly (i.e., it depends 215 // containing block. If the height of the containing block is not specified explicitly (i.e., it depends
216 // on content height), and this element is not absolutely positioned, the va lue computes to 'auto'. 216 // on content height), and this element is not absolutely positioned, the va lue computes to 'auto'.
217 if (!logicalHeightLength.isPercent() || isOutOfFlowPositioned() || document( )->inQuirksMode()) 217 if (!logicalHeightLength.isPercent() || isOutOfFlowPositioned() || document( ).inQuirksMode())
218 return false; 218 return false;
219 219
220 // Anonymous block boxes are ignored when resolving percentage values that w ould refer to it: 220 // Anonymous block boxes are ignored when resolving percentage values that w ould refer to it:
221 // the closest non-anonymous ancestor box is used instead. 221 // the closest non-anonymous ancestor box is used instead.
222 RenderBlock* cb = containingBlock(); 222 RenderBlock* cb = containingBlock();
223 while (cb->isAnonymous()) 223 while (cb->isAnonymous())
224 cb = cb->containingBlock(); 224 cb = cb->containingBlock();
225 225
226 // Matching RenderBox::percentageLogicalHeightIsResolvableFromBlock() by 226 // Matching RenderBox::percentageLogicalHeightIsResolvableFromBlock() by
227 // ignoring table cell's attribute value, where it says that table cells vio late 227 // ignoring table cell's attribute value, where it says that table cells vio late
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 bool hasRoundedBorder = style()->hasBorderRadius() && (includeLeftEdge || in cludeRightEdge); 533 bool hasRoundedBorder = style()->hasBorderRadius() && (includeLeftEdge || in cludeRightEdge);
534 bool clippedWithLocalScrolling = hasOverflowClip() && bgLayer->attachment() == LocalBackgroundAttachment; 534 bool clippedWithLocalScrolling = hasOverflowClip() && bgLayer->attachment() == LocalBackgroundAttachment;
535 bool isBorderFill = bgLayer->clip() == BorderFillBox; 535 bool isBorderFill = bgLayer->clip() == BorderFillBox;
536 bool isRoot = this->isRoot(); 536 bool isRoot = this->isRoot();
537 537
538 Color bgColor = color; 538 Color bgColor = color;
539 StyleImage* bgImage = bgLayer->image(); 539 StyleImage* bgImage = bgLayer->image();
540 bool shouldPaintBackgroundImage = bgImage && bgImage->canRender(this, style( )->effectiveZoom()); 540 bool shouldPaintBackgroundImage = bgImage && bgImage->canRender(this, style( )->effectiveZoom());
541 541
542 bool forceBackgroundToWhite = false; 542 bool forceBackgroundToWhite = false;
543 if (document()->printing()) { 543 if (document().printing()) {
544 if (style()->printColorAdjust() == PrintColorAdjustEconomy) 544 if (style()->printColorAdjust() == PrintColorAdjustEconomy)
545 forceBackgroundToWhite = true; 545 forceBackgroundToWhite = true;
546 if (document()->settings() && document()->settings()->shouldPrintBackgro unds()) 546 if (document().settings() && document().settings()->shouldPrintBackgroun ds())
547 forceBackgroundToWhite = false; 547 forceBackgroundToWhite = false;
548 } 548 }
549 549
550 // When printing backgrounds is disabled or using economy mode, 550 // When printing backgrounds is disabled or using economy mode,
551 // change existing background colors and images to a solid white background. 551 // change existing background colors and images to a solid white background.
552 // If there's no bg color or image, leave it untouched to avoid affecting tr ansparency. 552 // If there's no bg color or image, leave it untouched to avoid affecting tr ansparency.
553 // We don't try to avoid loading the background images, because this style f lag is only set 553 // We don't try to avoid loading the background images, because this style f lag is only set
554 // when printing, and at that point we've already loaded the background imag es anyway. (To avoid 554 // when printing, and at that point we've already loaded the background imag es anyway. (To avoid
555 // loading the background images we'd have to do this check when applying st yles rather than 555 // loading the background images we'd have to do this check when applying st yles rather than
556 // while rendering.) 556 // while rendering.)
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 ASSERT_NOT_REACHED(); 667 ASSERT_NOT_REACHED();
668 break; 668 break;
669 } 669 }
670 670
671 // Only fill with a base color (e.g., white) if we're the root document, sin ce iframes/frames with 671 // Only fill with a base color (e.g., white) if we're the root document, sin ce iframes/frames with
672 // no background in the child document should show the parent's background. 672 // no background in the child document should show the parent's background.
673 bool isOpaqueRoot = false; 673 bool isOpaqueRoot = false;
674 if (isRoot) { 674 if (isRoot) {
675 isOpaqueRoot = true; 675 isOpaqueRoot = true;
676 if (!bgLayer->next() && !(bgColor.alpha() == 255) && view()->frameView() ) { 676 if (!bgLayer->next() && !(bgColor.alpha() == 255) && view()->frameView() ) {
677 Element* ownerElement = document()->ownerElement(); 677 Element* ownerElement = document().ownerElement();
678 if (ownerElement) { 678 if (ownerElement) {
679 if (!ownerElement->hasTagName(frameTag)) { 679 if (!ownerElement->hasTagName(frameTag)) {
680 // Locate the <body> element using the DOM. This is easier than trying 680 // Locate the <body> element using the DOM. This is easier than trying
681 // to crawl around a render tree with potential :before/:aft er content and 681 // to crawl around a render tree with potential :before/:aft er content and
682 // anonymous blocks created by inline <body> tags etc. We c an locate the <body> 682 // anonymous blocks created by inline <body> tags etc. We c an locate the <body>
683 // render object very easily via the DOM. 683 // render object very easily via the DOM.
684 HTMLElement* body = document()->body(); 684 HTMLElement* body = document().body();
685 if (body) { 685 if (body) {
686 // Can't scroll a frameset document anyway. 686 // Can't scroll a frameset document anyway.
687 isOpaqueRoot = body->hasLocalName(framesetTag); 687 isOpaqueRoot = body->hasLocalName(framesetTag);
688 } else { 688 } else {
689 // SVG documents and XML documents with SVG root nodes a re transparent. 689 // SVG documents and XML documents with SVG root nodes a re transparent.
690 isOpaqueRoot = !document()->hasSVGRootNode(); 690 isOpaqueRoot = !document().hasSVGRootNode();
691 } 691 }
692 } 692 }
693 } else 693 } else
694 isOpaqueRoot = !view()->frameView()->isTransparent(); 694 isOpaqueRoot = !view()->frameView()->isTransparent();
695 } 695 }
696 view()->frameView()->setContentIsOpaque(isOpaqueRoot); 696 view()->frameView()->setContentIsOpaque(isOpaqueRoot);
697 } 697 }
698 698
699 // Paint the color first underneath all images, culled if background image o ccludes it. 699 // Paint the color first underneath all images, culled if background image o ccludes it.
700 // FIXME: In the bgLayer->hasFiniteBounds() case, we could improve the culli ng test 700 // FIXME: In the bgLayer->hasFiniteBounds() case, we could improve the culli ng test
(...skipping 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after
2786 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 2786 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
2787 for (RenderObject* child = startChild; child && child != endChild; ) { 2787 for (RenderObject* child = startChild; child && child != endChild; ) {
2788 // Save our next sibling as moveChildTo will clear it. 2788 // Save our next sibling as moveChildTo will clear it.
2789 RenderObject* nextSibling = child->nextSibling(); 2789 RenderObject* nextSibling = child->nextSibling();
2790 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); 2790 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert);
2791 child = nextSibling; 2791 child = nextSibling;
2792 } 2792 }
2793 } 2793 }
2794 2794
2795 } // namespace WebCore 2795 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBox.cpp ('k') | Source/core/rendering/RenderDeprecatedFlexibleBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698