RESOLVED FIXED 122969
Move m_lineBoxes from RenderBlock to RenderBlockFlow
https://bugs.webkit.org/show_bug.cgi?id=122969
Summary Move m_lineBoxes from RenderBlock to RenderBlockFlow
Sam Weinig
Reported 2013-10-17 10:03:29 PDT
As part of the great RenderBlockFlow refactor, move m_lineBoxes from RenderBlock to RenderBlockFlow.
Attachments
WIP (78.34 KB, patch)
2013-10-17 10:17 PDT, Sam Weinig
no flags
Part 1 (36.28 KB, patch)
2013-10-18 20:05 PDT, Sam Weinig
no flags
Part 2 (24.05 KB, patch)
2013-10-18 23:28 PDT, Sam Weinig
no flags
Part 3 (4.88 KB, patch)
2013-10-19 13:13 PDT, Sam Weinig
no flags
Patch 4 (33.01 KB, patch)
2013-10-19 14:19 PDT, Sam Weinig
no flags
Patch 4 (take 2) (33.25 KB, patch)
2013-10-19 14:24 PDT, Sam Weinig
no flags
Part 5 (71.83 KB, patch)
2013-10-20 13:06 PDT, Sam Weinig
koivisto: review+
Sam Weinig
Comment 1 2013-10-17 10:17:54 PDT
Created attachment 214467 [details] WIP It compiles and passes all the tests. But I need to fix a bunch of the FIXMEs I left for myself.
Dave Hyatt
Comment 2 2013-10-17 11:03:05 PDT
Comment on attachment 214467 [details] WIP View in context: https://bugs.webkit.org/attachment.cgi?id=214467&action=review Looks pretty good. A couple of comments: > Source/WebCore/rendering/RenderBlock.cpp:230 > if (!documentBeingDestroyed()) { > - if (firstLineBox()) { > - // We can't wait for RenderBox::destroy to clear the selection, > - // because by then we will have nuked the line boxes. > - // FIXME: The FrameSelection should be responsible for this when it > - // is notified of DOM mutations. > - if (isSelectionBorder()) > - view().clearSelection(); > - > - // If we are an anonymous block, then our line boxes might have children > - // that will outlast this block. In the non-anonymous block case those > - // children will be destroyed by the time we return from this function. > - if (isAnonymousBlock()) { > - for (auto box = firstLineBox(); box; box = box->nextLineBox()) { > - while (auto childBox = box->firstChild()) > - childBox->removeFromParent(); > - } > - } > - } else if (parent()) > + if (parent()) > parent()->dirtyLinesFromChangedChild(this); In my patch for this, I opted for the following: if (!documentBeingDestroyed() && parent() && !isRenderBlockFlow()) parent()->dirtyLinesFromChangedChild(this); That allows you to not duplicate all the code in RenderBlockFlow::willBeDestroyed. > Source/WebCore/rendering/RenderBlock.cpp:2274 > +// FIXME: This is partially duplicated in RenderBlockFlow::paintContents. Fix before landing. There is a specific FIXME I've been using for blockflow, i.e., FIXME-BLOCKFLOW. You can use that.
Dave Hyatt
Comment 3 2013-10-17 11:04:24 PDT
I'm a bit nervous about virtualizing the line box accessors too, but as long as it's temporary. I was trying to go further, but that's a clever way to make the patch way smaller. :)
Sam Weinig
Comment 4 2013-10-17 16:48:35 PDT
(In reply to comment #3) > I'm a bit nervous about virtualizing the line box accessors too, but as long as it's temporary. I was trying to go further, but that's a clever way to make the patch way smaller. :) Yeah, it worries me too. I'm going to try to fix it.
Sam Weinig
Comment 5 2013-10-18 20:05:06 PDT
Sam Weinig
Comment 6 2013-10-18 20:06:21 PDT
(In reply to comment #5) > Created an attachment (id=214632) [details] > Patch I decided to split it up into chunks. Here is the first one.
Sam Weinig
Comment 7 2013-10-18 20:13:27 PDT
Comment on attachment 214632 [details] Part 1 Part 1 committed in revision 157662
Sam Weinig
Comment 8 2013-10-18 23:28:51 PDT
WebKit Commit Bot
Comment 9 2013-10-18 23:30:52 PDT
Attachment 214641 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/rendering/EllipsisBox.cpp', u'Source/WebCore/rendering/EllipsisBox.h', u'Source/WebCore/rendering/RenderBlock.cpp', u'Source/WebCore/rendering/RenderBlock.h', u'Source/WebCore/rendering/RenderBlockFlow.cpp', u'Source/WebCore/rendering/RenderBlockFlow.h', u'Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp', u'Source/WebCore/rendering/RootInlineBox.cpp']" exit_code: 1 Source/WebCore/rendering/RenderBlockFlow.cpp:2476: l is incorrectly named. Don't use the single letter 'l' as an identifier name. [readability/naming] [4] Source/WebCore/rendering/RenderBlockFlow.cpp:2496: Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons. [readability/comparison_to_zero] [5] Source/WebCore/rendering/RenderBlockFlow.cpp:2503: l is incorrectly named. Don't use the single letter 'l' as an identifier name. [readability/naming] [4] Total errors found: 3 in 7 files If any of these errors are false positives, please file a bug against check-webkit-style.
Antti Koivisto
Comment 10 2013-10-19 00:04:46 PDT
Comment on attachment 214641 [details] Part 2 View in context: https://bugs.webkit.org/attachment.cgi?id=214641&action=review > Source/WebCore/rendering/RenderBlockFlow.cpp:2416 > +// Helper methods for obtaining the last line, computing line counts and heights for line counts (crawling into blocks). > +static bool shouldCheckLines(RenderObject* obj) > +{ The comment seems to be about the next function. This one could take reference instead of pointer. > Source/WebCore/rendering/RenderBlockFlow.cpp:2425 > + return 0; nullptr > Source/WebCore/rendering/RenderBlockFlow.cpp:2431 > + if (childrenInline()) { > + for (auto box = firstRootBox(); box; box = box->nextRootBox()) > + if (!i--) > + return box; > + } else { This could use early return. > Source/WebCore/rendering/RenderBlockFlow.cpp:2440 > + return 0; nullptr > Source/WebCore/rendering/RenderBlockFlow.cpp:2446 > + return 0; nullptr > Source/WebCore/rendering/RenderBlockFlow.cpp:2459 > + if (childrenInline()) { > + for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBox()) { > + count++; > + if (box == stopRootInlineBox) { > + if (found) > + *found = true; > + break; > + } > + } > + } else { Early return >> Source/WebCore/rendering/RenderBlockFlow.cpp:2476 >> +static int getHeightForLineCount(RenderBlockFlow* block, int l, bool includeBottom, int& count) > > l is incorrectly named. Don't use the single letter 'l' as an identifier name. [readability/naming] [4] const reference > Source/WebCore/rendering/RenderBlockFlow.cpp:2486 > + if (block->childrenInline()) { > + for (auto box = block->firstRootBox(); box; box = box->nextRootBox()) { > + if (++count == l) > + return box->lineBottom() + (includeBottom ? (block->borderBottom() + block->paddingBottom()) : LayoutUnit()); > + } > + } else { Early return > Source/WebCore/rendering/RenderBlockFlow.cpp:2518 > + if (childrenInline() && hasMarkupTruncation()) { > + setHasMarkupTruncation(false); > + for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBox()) > + box->clearTruncation(); > + } else { Early return > Source/WebCore/rendering/RenderBlockFlow.h:301 > + int lineCount(const RootInlineBox* = 0, bool* = 0) const; nullptrs
Sam Weinig
Comment 11 2013-10-19 12:54:46 PDT
Comment on attachment 214641 [details] Part 2 Part 2 committed in revision 157674.
Sam Weinig
Comment 12 2013-10-19 13:13:19 PDT
Sam Weinig
Comment 13 2013-10-19 13:25:39 PDT
Comment on attachment 214662 [details] Part 3 Part 3 committed in revision 157677.
Sam Weinig
Comment 14 2013-10-19 14:19:47 PDT
EFL EWS Bot
Comment 15 2013-10-19 14:23:37 PDT
Sam Weinig
Comment 16 2013-10-19 14:24:58 PDT
Created attachment 214672 [details] Patch 4 (take 2)
Sam Weinig
Comment 17 2013-10-19 14:41:50 PDT
Sam Weinig
Comment 18 2013-10-19 14:42:42 PDT
Did not mean to close. I'm not done yet.
Sam Weinig
Comment 19 2013-10-20 13:06:37 PDT
WebKit Commit Bot
Comment 20 2013-10-20 13:08:42 PDT
Attachment 214705 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/accessibility/AccessibilityRenderObject.cpp', u'Source/WebCore/rendering/HitTestResult.cpp', u'Source/WebCore/rendering/RenderBlock.cpp', u'Source/WebCore/rendering/RenderBlock.h', u'Source/WebCore/rendering/RenderBlockFlow.cpp', u'Source/WebCore/rendering/RenderBlockFlow.h', u'Source/WebCore/rendering/RenderBlockLineLayout.cpp', u'Source/WebCore/rendering/RootInlineBox.cpp']" exit_code: 1 Source/WebCore/rendering/RenderBlock.cpp:4646: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Source/WebCore/rendering/RenderBlock.cpp:4647: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Source/WebCore/rendering/RenderBlockFlow.cpp:2413: Should have only a single space after a punctuation in a comment. [whitespace/comments] [5] Source/WebCore/rendering/RenderBlockFlow.cpp:2521: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Source/WebCore/rendering/RenderBlockFlow.cpp:2522: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Source/WebCore/rendering/RenderBlockFlow.cpp:2560: Boolean expressions that span multiple lines should have their operators on the left side of the line instead of the right side. [whitespace/operators] [4] Source/WebCore/rendering/RenderBlockFlow.cpp:2890: Should have only a single space after a punctuation in a comment. [whitespace/comments] [5] Source/WebCore/rendering/RenderBlockFlow.cpp:2898: Should have only a single space after a punctuation in a comment. [whitespace/comments] [5] Total errors found: 8 in 9 files If any of these errors are false positives, please file a bug against check-webkit-style.
Sam Weinig
Comment 21 2013-10-20 15:56:13 PDT
Note You need to log in before you can comment on or make changes to this bug.