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

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

Issue 2929763002: Introduce InlineTextBoxesOf() for ease of loop over InlineTextBox of LayoutText (Closed)
Patch Set: 2017-06-08T17:21:30 Revise variable name in ComputeInlineBoxPositionTempalte to make patch size smaller Created 3 years, 6 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. 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 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 } else { 699 } else {
700 yield(LayoutRect( 700 yield(LayoutRect(
701 logical_top, 701 logical_top,
702 LayoutUnit(child_line->Y() - child_line->MarginLogicalLeft()), 702 LayoutUnit(child_line->Y() - child_line->MarginLogicalLeft()),
703 logical_height, logical_width)); 703 logical_height, logical_width));
704 } 704 }
705 } 705 }
706 } 706 }
707 } else if (curr->IsText()) { 707 } else if (curr->IsText()) {
708 LayoutText* curr_text = ToLayoutText(curr); 708 LayoutText* curr_text = ToLayoutText(curr);
709 for (InlineTextBox* child_text = curr_text->FirstTextBox(); child_text; 709 for (InlineTextBox* child_text : InlineTextBoxesOf(*curr_text)) {
710 child_text = child_text->NextTextBox()) {
711 RootInlineBox& root_box = child_text->Root(); 710 RootInlineBox& root_box = child_text->Root();
712 ComputeItemTopHeight(container, root_box, &logical_top, 711 ComputeItemTopHeight(container, root_box, &logical_top,
713 &logical_height); 712 &logical_height);
714 if (is_horizontal) 713 if (is_horizontal)
715 yield(LayoutRect(child_text->X(), logical_top, 714 yield(LayoutRect(child_text->X(), logical_top,
716 child_text->LogicalWidth(), logical_height)); 715 child_text->LogicalWidth(), logical_height));
717 else 716 else
718 yield(LayoutRect(logical_top, child_text->Y(), logical_height, 717 yield(LayoutRect(logical_top, child_text->Y(), logical_height,
719 child_text->LogicalWidth())); 718 child_text->LogicalWidth()));
720 } 719 }
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 if (curr_box->InlineBoxWrapper()) 1332 if (curr_box->InlineBoxWrapper())
1334 curr_box->InlineBoxWrapper()->Root().MarkDirty(); 1333 curr_box->InlineBoxWrapper()->Root().MarkDirty();
1335 } else if (!curr->SelfNeedsLayout()) { 1334 } else if (!curr->SelfNeedsLayout()) {
1336 if (curr->IsLayoutInline()) { 1335 if (curr->IsLayoutInline()) {
1337 LayoutInline* curr_inline = ToLayoutInline(curr); 1336 LayoutInline* curr_inline = ToLayoutInline(curr);
1338 for (InlineFlowBox* child_line = curr_inline->FirstLineBox(); 1337 for (InlineFlowBox* child_line = curr_inline->FirstLineBox();
1339 child_line; child_line = child_line->NextLineBox()) 1338 child_line; child_line = child_line->NextLineBox())
1340 child_line->Root().MarkDirty(); 1339 child_line->Root().MarkDirty();
1341 } else if (curr->IsText()) { 1340 } else if (curr->IsText()) {
1342 LayoutText* curr_text = ToLayoutText(curr); 1341 LayoutText* curr_text = ToLayoutText(curr);
1343 for (InlineTextBox* child_text = curr_text->FirstTextBox(); 1342 for (InlineTextBox* child_text : InlineTextBoxesOf(*curr_text))
1344 child_text; child_text = child_text->NextTextBox())
1345 child_text->Root().MarkDirty(); 1343 child_text->Root().MarkDirty();
1346 } 1344 }
1347 } 1345 }
1348 } 1346 }
1349 } else { 1347 } else {
1350 line_boxes_.DirtyLineBoxes(); 1348 line_boxes_.DirtyLineBoxes();
1351 } 1349 }
1352 } 1350 }
1353 1351
1354 InlineFlowBox* LayoutInline::CreateInlineFlowBox() { 1352 InlineFlowBox* LayoutInline::CreateInlineFlowBox() {
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 paint_invalidator.InvalidateDisplayItemClient(*box, invalidation_reason); 1549 paint_invalidator.InvalidateDisplayItemClient(*box, invalidation_reason);
1552 } 1550 }
1553 1551
1554 // TODO(lunalu): Not to just dump 0, 0 as the x and y here 1552 // TODO(lunalu): Not to just dump 0, 0 as the x and y here
1555 LayoutRect LayoutInline::DebugRect() const { 1553 LayoutRect LayoutInline::DebugRect() const {
1556 IntRect lines_box = EnclosingIntRect(LinesBoundingBox()); 1554 IntRect lines_box = EnclosingIntRect(LinesBoundingBox());
1557 return LayoutRect(IntRect(0, 0, lines_box.Width(), lines_box.Height())); 1555 return LayoutRect(IntRect(0, 0, lines_box.Width(), lines_box.Height()));
1558 } 1556 }
1559 1557
1560 } // namespace blink 1558 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutText.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698