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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp

Issue 2225033003: Separate backgroundObscurationStatus and hasBoxDecorationBackground (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 4 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
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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 // line boxes, so descendants don't need to add line boxes again. For ex ample, if the parent 481 // line boxes, so descendants don't need to add line boxes again. For ex ample, if the parent
482 // is a LayoutBlock, it adds rects for its RootOutlineBoxes which cover the line boxes of 482 // is a LayoutBlock, it adds rects for its RootOutlineBoxes which cover the line boxes of
483 // this LayoutInline. So the LayoutInline needs to add rects for childre n and continuations only. 483 // this LayoutInline. So the LayoutInline needs to add rects for childre n and continuations only.
484 toLayoutInline(descendant).addOutlineRectsForChildrenAndContinuations(re cts, additionalOffset, includeBlockOverflows); 484 toLayoutInline(descendant).addOutlineRectsForChildrenAndContinuations(re cts, additionalOffset, includeBlockOverflows);
485 return; 485 return;
486 } 486 }
487 487
488 descendant.addOutlineRects(rects, additionalOffset, includeBlockOverflows); 488 descendant.addOutlineRects(rects, additionalOffset, includeBlockOverflows);
489 } 489 }
490 490
491 bool LayoutBoxModelObject::calculateHasBoxDecorations() const
492 {
493 const ComputedStyle& styleToUse = styleRef();
494 return hasBackground() || styleToUse.hasBorderDecoration() || styleToUse.has Appearance() || styleToUse.boxShadow();
495 }
496
497 bool LayoutBoxModelObject::hasNonEmptyLayoutSize() const 491 bool LayoutBoxModelObject::hasNonEmptyLayoutSize() const
498 { 492 {
499 for (const LayoutBoxModelObject* root = this; root; root = root->continuatio n()) { 493 for (const LayoutBoxModelObject* root = this; root; root = root->continuatio n()) {
500 for (const LayoutObject* object = root; object; object = object->nextInP reOrder(object)) { 494 for (const LayoutObject* object = root; object; object = object->nextInP reOrder(object)) {
501 if (object->isBox()) { 495 if (object->isBox()) {
502 const LayoutBox& box = toLayoutBox(*object); 496 const LayoutBox& box = toLayoutBox(*object);
503 if (box.logicalHeight() && box.logicalWidth()) 497 if (box.logicalHeight() && box.logicalWidth())
504 return true; 498 return true;
505 } else if (object->isLayoutInline()) { 499 } else if (object->isLayoutInline()) {
506 const LayoutInline& layoutInline = toLayoutInline(*object); 500 const LayoutInline& layoutInline = toLayoutInline(*object);
507 if (!layoutInline.linesBoundingBox().isEmpty()) 501 if (!layoutInline.linesBoundingBox().isEmpty())
508 return true; 502 return true;
509 } else { 503 } else {
510 ASSERT(object->isText()); 504 ASSERT(object->isText());
511 } 505 }
512 } 506 }
513 } 507 }
514 return false; 508 return false;
515 } 509 }
516 510
517 void LayoutBoxModelObject::updateFromStyle() 511 void LayoutBoxModelObject::updateFromStyle()
518 { 512 {
519 const ComputedStyle& styleToUse = styleRef(); 513 const ComputedStyle& styleToUse = styleRef();
520 setHasBoxDecorationBackground(calculateHasBoxDecorations()); 514 setHasBoxDecorationBackground(styleToUse.hasBoxDecorationBackground());
521 setInline(styleToUse.isDisplayInlineType()); 515 setInline(styleToUse.isDisplayInlineType());
522 setPositionState(styleToUse.position()); 516 setPositionState(styleToUse.position());
523 setHorizontalWritingMode(styleToUse.isHorizontalWritingMode()); 517 setHorizontalWritingMode(styleToUse.isHorizontalWritingMode());
524 } 518 }
525 519
526 LayoutBlock* LayoutBoxModelObject::containingBlockForAutoHeightDetection(Length logicalHeight) const 520 LayoutBlock* LayoutBoxModelObject::containingBlockForAutoHeightDetection(Length logicalHeight) const
527 { 521 {
528 // For percentage heights: The percentage is calculated with respect to the height of the generated box's 522 // For percentage heights: The percentage is calculated with respect to the height of the generated box's
529 // containing block. If the height of the containing block is not specified explicitly (i.e., it depends 523 // containing block. If the height of the containing block is not specified explicitly (i.e., it depends
530 // on content height), and this element is not absolutely positioned, the u sed height is calculated 524 // on content height), and this element is not absolutely positioned, the u sed height is calculated
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 if (rootElementStyle->hasBackground()) 1129 if (rootElementStyle->hasBackground())
1136 return false; 1130 return false;
1137 1131
1138 if (node() != document().firstBodyElement()) 1132 if (node() != document().firstBodyElement())
1139 return false; 1133 return false;
1140 1134
1141 return true; 1135 return true;
1142 } 1136 }
1143 1137
1144 } // namespace blink 1138 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutBoxTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698