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

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

Issue 1974323002: Move inlineElementContinuation() to LayoutBlockFlow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review. Created 4 years, 7 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 525
526 void LayoutBoxModelObject::updateFromStyle() 526 void LayoutBoxModelObject::updateFromStyle()
527 { 527 {
528 const ComputedStyle& styleToUse = styleRef(); 528 const ComputedStyle& styleToUse = styleRef();
529 setHasBoxDecorationBackground(calculateHasBoxDecorations()); 529 setHasBoxDecorationBackground(calculateHasBoxDecorations());
530 setInline(styleToUse.isDisplayInlineType()); 530 setInline(styleToUse.isDisplayInlineType());
531 setPositionState(styleToUse.position()); 531 setPositionState(styleToUse.position());
532 setHorizontalWritingMode(styleToUse.isHorizontalWritingMode()); 532 setHorizontalWritingMode(styleToUse.isHorizontalWritingMode());
533 } 533 }
534 534
535 static LayoutSize accumulateInFlowPositionOffsets(const LayoutObject* child)
536 {
537 if (!child->isAnonymousBlock() || !child->isInFlowPositioned())
538 return LayoutSize();
539 LayoutSize offset;
540 LayoutObject* p = toLayoutBlock(child)->inlineElementContinuation();
541 while (p && p->isLayoutInline()) {
542 if (p->isInFlowPositioned()) {
543 LayoutInline* layoutInline = toLayoutInline(p);
544 offset += layoutInline->offsetForInFlowPosition();
545 }
546 p = p->parent();
547 }
548 return offset;
549 }
550
551 LayoutBlock* LayoutBoxModelObject::containingBlockForAutoHeightDetection(Length logicalHeight) const 535 LayoutBlock* LayoutBoxModelObject::containingBlockForAutoHeightDetection(Length logicalHeight) const
552 { 536 {
553 // For percentage heights: The percentage is calculated with respect to the height of the generated box's 537 // For percentage heights: The percentage is calculated with respect to the height of the generated box's
554 // containing block. If the height of the containing block is not specified explicitly (i.e., it depends 538 // containing block. If the height of the containing block is not specified explicitly (i.e., it depends
555 // on content height), and this element is not absolutely positioned, the u sed height is calculated 539 // on content height), and this element is not absolutely positioned, the u sed height is calculated
556 // as if 'auto' was specified. 540 // as if 'auto' was specified.
557 if (!logicalHeight.hasPercent() || isOutOfFlowPositioned()) 541 if (!logicalHeight.hasPercent() || isOutOfFlowPositioned())
558 return nullptr; 542 return nullptr;
559 543
560 // Anonymous block boxes are ignored when resolving percentage values that w ould refer to it: 544 // Anonymous block boxes are ignored when resolving percentage values that w ould refer to it:
(...skipping 30 matching lines...) Expand all
591 return false; 575 return false;
592 576
593 // If the height of the containing block computes to 'auto', then it hasn't been 'specified explicitly'. 577 // If the height of the containing block computes to 'auto', then it hasn't been 'specified explicitly'.
594 if (LayoutBlock* cb = containingBlockForAutoHeightDetection(logicalHeightLen gth)) 578 if (LayoutBlock* cb = containingBlockForAutoHeightDetection(logicalHeightLen gth))
595 return cb->hasAutoHeightOrContainingBlockWithAutoHeight(); 579 return cb->hasAutoHeightOrContainingBlockWithAutoHeight();
596 return false; 580 return false;
597 } 581 }
598 582
599 LayoutSize LayoutBoxModelObject::relativePositionOffset() const 583 LayoutSize LayoutBoxModelObject::relativePositionOffset() const
600 { 584 {
601 LayoutSize offset = accumulateInFlowPositionOffsets(this); 585 LayoutSize offset = accumulateInFlowPositionOffsets();
602 586
603 LayoutBlock* containingBlock = this->containingBlock(); 587 LayoutBlock* containingBlock = this->containingBlock();
604 588
605 // Objects that shrink to avoid floats normally use available line width whe n computing containing block width. However 589 // Objects that shrink to avoid floats normally use available line width whe n computing containing block width. However
606 // in the case of relative positioning using percentages, we can't do this. The offset should always be resolved using the 590 // in the case of relative positioning using percentages, we can't do this. The offset should always be resolved using the
607 // available width of the containing block. Therefore we don't use containi ngBlockLogicalWidthForContent() here, but instead explicitly 591 // available width of the containing block. Therefore we don't use containi ngBlockLogicalWidthForContent() here, but instead explicitly
608 // call availableWidth on our containing block. 592 // call availableWidth on our containing block.
609 if (!style()->left().isAuto()) { 593 if (!style()->left().isAuto()) {
610 if (!style()->right().isAuto() && !containingBlock->style()->isLeftToRig htDirection()) 594 if (!style()->right().isAuto() && !containingBlock->style()->isLeftToRig htDirection())
611 offset.setWidth(-valueForLength(style()->right(), containingBlock->a vailableWidth())); 595 offset.setWidth(-valueForLength(style()->right(), containingBlock->a vailableWidth()));
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 if (rootElementStyle->hasBackground()) 1116 if (rootElementStyle->hasBackground())
1133 return false; 1117 return false;
1134 1118
1135 if (node() != document().firstBodyElement()) 1119 if (node() != document().firstBodyElement())
1136 return false; 1120 return false;
1137 1121
1138 return true; 1122 return true;
1139 } 1123 }
1140 1124
1141 } // namespace blink 1125 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h ('k') | third_party/WebKit/Source/core/layout/LayoutInline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698