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

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

Issue 1212893005: Add position: sticky as supported position value when CSSStickyPosition is enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Merge, convert pixel to ref tests, and address comments. Created 5 years, 5 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
« no previous file with comments | « Source/core/layout/LayoutBox.cpp ('k') | Source/core/layout/LayoutInline.h » ('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 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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 { 447 {
448 const ComputedStyle& styleToUse = styleRef(); 448 const ComputedStyle& styleToUse = styleRef();
449 setHasBoxDecorationBackground(calculateHasBoxDecorations()); 449 setHasBoxDecorationBackground(calculateHasBoxDecorations());
450 setInline(styleToUse.isDisplayInlineType()); 450 setInline(styleToUse.isDisplayInlineType());
451 setPositionState(styleToUse.position()); 451 setPositionState(styleToUse.position());
452 setHorizontalWritingMode(styleToUse.isHorizontalWritingMode()); 452 setHorizontalWritingMode(styleToUse.isHorizontalWritingMode());
453 } 453 }
454 454
455 static LayoutSize accumulateInFlowPositionOffsets(const LayoutObject* child) 455 static LayoutSize accumulateInFlowPositionOffsets(const LayoutObject* child)
456 { 456 {
457 if (!child->isAnonymousBlock() || !child->isRelPositioned()) 457 if (!child->isAnonymousBlock() || !child->isInFlowPositioned())
458 return LayoutSize(); 458 return LayoutSize();
459 LayoutSize offset; 459 LayoutSize offset;
460 LayoutObject* p = toLayoutBlock(child)->inlineElementContinuation(); 460 LayoutObject* p = toLayoutBlock(child)->inlineElementContinuation();
461 while (p && p->isLayoutInline()) { 461 while (p && p->isLayoutInline()) {
462 if (p->isRelPositioned()) { 462 if (p->isInFlowPositioned()) {
463 LayoutInline* layoutInline = toLayoutInline(p); 463 LayoutInline* layoutInline = toLayoutInline(p);
464 offset += layoutInline->offsetForInFlowPosition(); 464 offset += layoutInline->offsetForInFlowPosition();
465 } 465 }
466 p = p->parent(); 466 p = p->parent();
467 } 467 }
468 return offset; 468 return offset;
469 } 469 }
470 470
471 LayoutBlock* LayoutBoxModelObject::containingBlockForAutoHeightDetection(Length logicalHeight) const 471 LayoutBlock* LayoutBoxModelObject::containingBlockForAutoHeightDetection(Length logicalHeight) const
472 { 472 {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 // return the distance between the canvas origin and the left border edge 569 // return the distance between the canvas origin and the left border edge
570 // of the element and stop this algorithm. 570 // of the element and stop this algorithm.
571 Element* element = offsetParent(); 571 Element* element = offsetParent();
572 if (!element) 572 if (!element)
573 return referencePoint; 573 return referencePoint;
574 574
575 if (const LayoutBoxModelObject* offsetParent = element->layoutBoxModelObject ()) { 575 if (const LayoutBoxModelObject* offsetParent = element->layoutBoxModelObject ()) {
576 if (offsetParent->isBox() && !offsetParent->isBody()) 576 if (offsetParent->isBox() && !offsetParent->isBody())
577 referencePoint.move(-toLayoutBox(offsetParent)->borderLeft(), -toLay outBox(offsetParent)->borderTop()); 577 referencePoint.move(-toLayoutBox(offsetParent)->borderLeft(), -toLay outBox(offsetParent)->borderTop());
578 if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) { 578 if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) {
579 if (isRelPositioned()) 579 if (isInFlowPositioned())
580 referencePoint.move(relativePositionOffset()); 580 referencePoint.move(relativePositionOffset());
581 581
582 LayoutObject* current; 582 LayoutObject* current;
583 for (current = parent(); current != offsetParent && current->parent( ); current = current->parent()) { 583 for (current = parent(); current != offsetParent && current->parent( ); current = current->parent()) {
584 // FIXME: What are we supposed to do inside SVG content? 584 // FIXME: What are we supposed to do inside SVG content?
585 if (!isOutOfFlowPositioned()) { 585 if (!isOutOfFlowPositioned()) {
586 if (current->isBox() && !current->isTableRow()) 586 if (current->isBox() && !current->isTableRow())
587 referencePoint.moveBy(toLayoutBox(current)->topLeftLocat ion()); 587 referencePoint.moveBy(toLayoutBox(current)->topLeftLocat ion());
588 referencePoint.move(current->parent()->columnOffset(referenc ePoint)); 588 referencePoint.move(current->parent()->columnOffset(referenc ePoint));
589 } 589 }
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 if (rootElementStyle->hasBackground()) 1003 if (rootElementStyle->hasBackground())
1004 return false; 1004 return false;
1005 1005
1006 if (node() != document().firstBodyElement()) 1006 if (node() != document().firstBodyElement())
1007 return false; 1007 return false;
1008 1008
1009 return true; 1009 return true;
1010 } 1010 }
1011 1011
1012 } // namespace blink 1012 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBox.cpp ('k') | Source/core/layout/LayoutInline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698