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

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

Issue 2414683002: Make offsetTop/Left handle a relative positioned inline offsetParent correctly. (Closed)
Patch Set: Fixed broken rebase. Created 4 years, 1 month 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 | « third_party/WebKit/Source/core/layout/LayoutInline.h ('k') | no next file » | 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 775
776 } // unnamed namespace 776 } // unnamed namespace
777 777
778 void LayoutInline::absoluteQuadsForSelf(Vector<FloatQuad>& quads) const { 778 void LayoutInline::absoluteQuadsForSelf(Vector<FloatQuad>& quads) const {
779 AbsoluteQuadsGeneratorContext context(this, quads); 779 AbsoluteQuadsGeneratorContext context(this, quads);
780 generateLineBoxRects(context); 780 generateLineBoxRects(context);
781 if (quads.isEmpty()) 781 if (quads.isEmpty())
782 context(FloatRect()); 782 context(FloatRect());
783 } 783 }
784 784
785 LayoutPoint LayoutInline::firstLineBoxTopLeft() const {
786 if (InlineBox* firstBox = firstLineBoxIncludingCulling())
787 return firstBox->topLeft();
788 return LayoutPoint();
789 }
790
785 LayoutUnit LayoutInline::offsetLeft(const Element* parent) const { 791 LayoutUnit LayoutInline::offsetLeft(const Element* parent) const {
786 LayoutPoint topLeft; 792 return adjustedPositionRelativeTo(firstLineBoxTopLeft(), parent).x();
787 if (InlineBox* firstBox = firstLineBoxIncludingCulling()) {
788 topLeft = firstBox->topLeft();
789 }
790 return adjustedPositionRelativeTo(topLeft, parent).x();
791 } 793 }
792 794
793 LayoutUnit LayoutInline::offsetTop(const Element* parent) const { 795 LayoutUnit LayoutInline::offsetTop(const Element* parent) const {
794 LayoutPoint topLeft; 796 return adjustedPositionRelativeTo(firstLineBoxTopLeft(), parent).y();
795 if (InlineBox* firstBox = firstLineBoxIncludingCulling()) {
796 topLeft = firstBox->topLeft();
797 }
798 return adjustedPositionRelativeTo(topLeft, parent).y();
799 } 797 }
800 798
801 static LayoutUnit computeMargin(const LayoutInline* layoutObject, 799 static LayoutUnit computeMargin(const LayoutInline* layoutObject,
802 const Length& margin) { 800 const Length& margin) {
803 if (margin.isFixed()) 801 if (margin.isFixed())
804 return LayoutUnit(margin.value()); 802 return LayoutUnit(margin.value());
805 if (margin.isPercentOrCalc()) 803 if (margin.isPercentOrCalc())
806 return minimumValueForLength( 804 return minimumValueForLength(
807 margin, 805 margin,
808 std::max(LayoutUnit(), 806 std::max(LayoutUnit(),
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason); 1512 paintInvalidator.invalidateDisplayItemClient(*box, invalidationReason);
1515 } 1513 }
1516 1514
1517 // TODO(lunalu): Not to just dump 0, 0 as the x and y here 1515 // TODO(lunalu): Not to just dump 0, 0 as the x and y here
1518 LayoutRect LayoutInline::debugRect() const { 1516 LayoutRect LayoutInline::debugRect() const {
1519 IntRect linesBox = enclosingIntRect(linesBoundingBox()); 1517 IntRect linesBox = enclosingIntRect(linesBoundingBox());
1520 return LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height())); 1518 return LayoutRect(IntRect(0, 0, linesBox.width(), linesBox.height()));
1521 } 1519 }
1522 1520
1523 } // namespace blink 1521 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutInline.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698