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

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

Issue 1922223003: Change linesBoundingBox to return LayoutRect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 void operator()(const LayoutRect& rect) 857 void operator()(const LayoutRect& rect)
858 { 858 {
859 operator()(FloatRect(rect)); 859 operator()(FloatRect(rect));
860 } 860 }
861 private: 861 private:
862 FloatRect& m_rect; 862 FloatRect& m_rect;
863 }; 863 };
864 864
865 } // unnamed namespace 865 } // unnamed namespace
866 866
867 IntRect LayoutInline::linesBoundingBox() const 867 LayoutRect LayoutInline::linesBoundingBox() const
868 { 868 {
869 if (!alwaysCreateLineBoxes()) { 869 if (!alwaysCreateLineBoxes()) {
870 ASSERT(!firstLineBox()); 870 ASSERT(!firstLineBox());
871 FloatRect floatResult; 871 FloatRect floatResult;
872 LinesBoundingBoxGeneratorContext context(floatResult); 872 LinesBoundingBoxGeneratorContext context(floatResult);
873 generateCulledLineBoxRects(context, this); 873 generateCulledLineBoxRects(context, this);
874 return enclosingIntRect(floatResult); 874 return enclosingLayoutRect(floatResult);
875 } 875 }
876 876
877 IntRect result; 877 LayoutRect result;
878 878
879 // See <rdar://problem/5289721>, for an unknown reason the linked list here is sometimes inconsistent, first is non-zero and last is zero. We have been 879 // See <rdar://problem/5289721>, for an unknown reason the linked list here is sometimes inconsistent, first is non-zero and last is zero. We have been
880 // unable to reproduce this at all (and consequently unable to figure ot why this is happening). The assert will hopefully catch the problem in debug 880 // unable to reproduce this at all (and consequently unable to figure ot why this is happening). The assert will hopefully catch the problem in debug
881 // builds and help us someday figure out why. We also put in a redundant ch eck of lastLineBox() to avoid the crash for now. 881 // builds and help us someday figure out why. We also put in a redundant ch eck of lastLineBox() to avoid the crash for now.
882 ASSERT(!firstLineBox() == !lastLineBox()); // Either both are null or both e xist. 882 ASSERT(!firstLineBox() == !lastLineBox()); // Either both are null or both e xist.
883 if (firstLineBox() && lastLineBox()) { 883 if (firstLineBox() && lastLineBox()) {
884 // Return the width of the minimal left side and the maximal right side. 884 // Return the width of the minimal left side and the maximal right side.
885 LayoutUnit logicalLeftSide; 885 LayoutUnit logicalLeftSide;
886 LayoutUnit logicalRightSide; 886 LayoutUnit logicalRightSide;
887 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBo x()) { 887 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBo x()) {
888 if (curr == firstLineBox() || curr->logicalLeft() < logicalLeftSide) 888 if (curr == firstLineBox() || curr->logicalLeft() < logicalLeftSide)
889 logicalLeftSide = curr->logicalLeft(); 889 logicalLeftSide = curr->logicalLeft();
890 if (curr == firstLineBox() || curr->logicalRight() > logicalRightSid e) 890 if (curr == firstLineBox() || curr->logicalRight() > logicalRightSid e)
891 logicalRightSide = curr->logicalRight(); 891 logicalRightSide = curr->logicalRight();
892 } 892 }
893 893
894 bool isHorizontal = style()->isHorizontalWritingMode(); 894 bool isHorizontal = style()->isHorizontalWritingMode();
895 895
896 LayoutUnit x = isHorizontal ? logicalLeftSide : firstLineBox()->x(); 896 LayoutUnit x = isHorizontal ? logicalLeftSide : firstLineBox()->x();
897 LayoutUnit y = isHorizontal ? firstLineBox()->y() : logicalLeftSide; 897 LayoutUnit y = isHorizontal ? firstLineBox()->y() : logicalLeftSide;
898 LayoutUnit width = isHorizontal ? logicalRightSide - logicalLeftSide : l astLineBox()->logicalBottom() - x; 898 LayoutUnit width = isHorizontal ? logicalRightSide - logicalLeftSide : l astLineBox()->logicalBottom() - x;
899 LayoutUnit height = isHorizontal ? lastLineBox()->logicalBottom() - y : logicalRightSide - logicalLeftSide; 899 LayoutUnit height = isHorizontal ? lastLineBox()->logicalBottom() - y : logicalRightSide - logicalLeftSide;
900 result = enclosingIntRect(LayoutRect(x, y, width, height)); 900 result = LayoutRect(x, y, width, height);
901 } 901 }
902 902
903 return result; 903 return result;
904 } 904 }
905 905
906 InlineBox* LayoutInline::culledInlineFirstLineBox() const 906 InlineBox* LayoutInline::culledInlineFirstLineBox() const
907 { 907 {
908 for (LayoutObject* curr = firstChild(); curr; curr = curr->nextSibling()) { 908 for (LayoutObject* curr = firstChild(); curr; curr = curr->nextSibling()) {
909 if (curr->isFloatingOrOutOfFlowPositioned()) 909 if (curr->isFloatingOrOutOfFlowPositioned())
910 continue; 910 continue;
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 1366
1367 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const 1367 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const
1368 { 1368 {
1369 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r, invalidationReason); 1369 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r, invalidationReason);
1370 1370
1371 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) 1371 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
1372 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason); 1372 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason);
1373 } 1373 }
1374 1374
1375 } // namespace blink 1375 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutInline.h ('k') | third_party/WebKit/Source/core/layout/LayoutText.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698