|
|
Chromium Code Reviews|
Created:
4 years, 6 months ago by yosin_UTC9 Modified:
4 years, 5 months ago Reviewers:
pdr. CC:
blink-reviews, chromium-reviews Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionMake LocalFrame::nodeImage() to take an image for the element with :-webkit-drag pseudo class
This patch makes |LocalFrame::nodeImage()| to take image for element with
":-webkit-drag" pseudo class by re-factoring |DragImageBuilder|.
Before this patch, |nodeImage()| doesn't take ":-webkit-drag" and paints
dragged element with dirty layout tree, e.g. |LayoutObject::updateDragState()|
sets "Needs Style Recalc" for ":-webkit-drag". This causes layout tree update
in |BlockPainter::paint()| due by |LayoutObject::hasCursor()| which calls
|Document::updateStyleAndLayoutTreeIgnorePendingStylesheets()| via
|isEditingPosition()|.
This patch is a preparation of hoisting update layout for |isEditablePosition()|
, http://crrev.com/2089993003, which is called during layout tree building for
checking whether |LayoutBlock|
have caret or not.
BUG=623005
TEST=run-webkit-tests --gtest_filter=LocalFrameTest.nodeImage*
Committed: https://crrev.com/0aad49f542b1119bf3ef413ca9c1c08d2aecb699
Cr-Commit-Position: refs/heads/master@{#402100}
Patch Set 1 : 2016-06-23T15:48:19 #
Total comments: 6
Patch Set 2 : 2016-06-24T14:46:18 #
Messages
Total messages: 15 (8 generated)
Description was changed from ========== 2016-06-23T15:48:19 BUG= ========== to ========== Make LocalFrame::nodeImage() to take image for element with :drag pseudo class This patch makes |LocalFrame::nodeImage()| to take image for element with ":drag" pseudo class by re-factoring |DragImageBuilder|. This patch is a preparation of hoisting update layout for |isEditablePosition()| which is called during layout tree building for checking whether |LayoutBlock| have caret or not. BUG=n/a ==========
yosin@chromium.org changed reviewers: + pdr@chromium.org
PTAL
Hey yosin, this patch looks reasonable but I don't quite understand the purpose. Because LayoutObjects can get destroyed in many places, why refactor towards passing LayoutObjects instead of Node which is a little more stable? https://codereview.chromium.org/2094653002/diff/1/third_party/WebKit/Source/c... File third_party/WebKit/Source/core/frame/LocalFrame.cpp (right): https://codereview.chromium.org/2094653002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/frame/LocalFrame.cpp:154: LayoutObject* const m_draggedLayoutObject; Why "LayoutObject* const" instead of "const LayoutObject*"? https://codereview.chromium.org/2094653002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/frame/LocalFrame.cpp:606: // TODO(yosin): We should handle pseudo-class ":drag" as similar as I was a little confused by ":drag", I think we use ":-webkit-drag" https://codereview.chromium.org/2094653002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/frame/LocalFrame.cpp:615: layoutObject->updateDragState(true); Previously, calling updateDragState was the responsibility of DragImageBuilder but now it's split in two places. Can these be unified (either all in this function or all in DragImageBuilder)? This will make it harder to forget to call updateDragState. One option would be to just update the return statement: auto image = dragImageBuilder.createImage(); if (layoutObject) layoutObject->updateDragState(false); return image;
Description was changed from ========== Make LocalFrame::nodeImage() to take image for element with :drag pseudo class This patch makes |LocalFrame::nodeImage()| to take image for element with ":drag" pseudo class by re-factoring |DragImageBuilder|. This patch is a preparation of hoisting update layout for |isEditablePosition()| which is called during layout tree building for checking whether |LayoutBlock| have caret or not. BUG=n/a ========== to ========== Make LocalFrame::nodeImage() to take image for element with :-webkit-drag pseudo class This patch makes |LocalFrame::nodeImage()| to take image for element with ":-webkit-drag" pseudo class by re-factoring |DragImageBuilder|. Before this patch, |nodeImage()| doesn't take ":-webkit-drag" and paints dragged element with dirty layout tree, e.g. |LayoutObject::updateDragState()| sets "Needs Style Recalc" for ":-webkit-drag". This causes layout tree update in |BlockPainter::paint()| due by |LayoutObject::hasCursor()| which calls |Document::updateStyleAndLayoutTreeIgnorePendingStylesheets()| via |isEditingPosition()|. This patch is a preparation of hoisting update layout for |isEditablePosition()| which is called during layout tree building for checking whether |LayoutBlock| have caret or not. BUG=n/a TEST=run-webkit-tests --gtest_filter=LocalFrameTest.nodeImage* ==========
Description was changed from ========== Make LocalFrame::nodeImage() to take image for element with :-webkit-drag pseudo class This patch makes |LocalFrame::nodeImage()| to take image for element with ":-webkit-drag" pseudo class by re-factoring |DragImageBuilder|. Before this patch, |nodeImage()| doesn't take ":-webkit-drag" and paints dragged element with dirty layout tree, e.g. |LayoutObject::updateDragState()| sets "Needs Style Recalc" for ":-webkit-drag". This causes layout tree update in |BlockPainter::paint()| due by |LayoutObject::hasCursor()| which calls |Document::updateStyleAndLayoutTreeIgnorePendingStylesheets()| via |isEditingPosition()|. This patch is a preparation of hoisting update layout for |isEditablePosition()| which is called during layout tree building for checking whether |LayoutBlock| have caret or not. BUG=n/a TEST=run-webkit-tests --gtest_filter=LocalFrameTest.nodeImage* ========== to ========== Make LocalFrame::nodeImage() to take image for element with :-webkit-drag pseudo class This patch makes |LocalFrame::nodeImage()| to take image for element with ":-webkit-drag" pseudo class by re-factoring |DragImageBuilder|. Before this patch, |nodeImage()| doesn't take ":-webkit-drag" and paints dragged element with dirty layout tree, e.g. |LayoutObject::updateDragState()| sets "Needs Style Recalc" for ":-webkit-drag". This causes layout tree update in |BlockPainter::paint()| due by |LayoutObject::hasCursor()| which calls |Document::updateStyleAndLayoutTreeIgnorePendingStylesheets()| via |isEditingPosition()|. This patch is a preparation of hoisting update layout for |isEditablePosition()| , http://crrev.com/2089993003, which is called during layout tree building for checking whether |LayoutBlock| have caret or not. BUG=n/a TEST=run-webkit-tests --gtest_filter=LocalFrameTest.nodeImage* ==========
Description was changed from ========== Make LocalFrame::nodeImage() to take image for element with :-webkit-drag pseudo class This patch makes |LocalFrame::nodeImage()| to take image for element with ":-webkit-drag" pseudo class by re-factoring |DragImageBuilder|. Before this patch, |nodeImage()| doesn't take ":-webkit-drag" and paints dragged element with dirty layout tree, e.g. |LayoutObject::updateDragState()| sets "Needs Style Recalc" for ":-webkit-drag". This causes layout tree update in |BlockPainter::paint()| due by |LayoutObject::hasCursor()| which calls |Document::updateStyleAndLayoutTreeIgnorePendingStylesheets()| via |isEditingPosition()|. This patch is a preparation of hoisting update layout for |isEditablePosition()| , http://crrev.com/2089993003, which is called during layout tree building for checking whether |LayoutBlock| have caret or not. BUG=n/a TEST=run-webkit-tests --gtest_filter=LocalFrameTest.nodeImage* ========== to ========== Make LocalFrame::nodeImage() to take an image for the element with :-webkit-drag pseudo class This patch makes |LocalFrame::nodeImage()| to take image for element with ":-webkit-drag" pseudo class by re-factoring |DragImageBuilder|. Before this patch, |nodeImage()| doesn't take ":-webkit-drag" and paints dragged element with dirty layout tree, e.g. |LayoutObject::updateDragState()| sets "Needs Style Recalc" for ":-webkit-drag". This causes layout tree update in |BlockPainter::paint()| due by |LayoutObject::hasCursor()| which calls |Document::updateStyleAndLayoutTreeIgnorePendingStylesheets()| via |isEditingPosition()|. This patch is a preparation of hoisting update layout for |isEditablePosition()| , http://crrev.com/2089993003, which is called during layout tree building for checking whether |LayoutBlock| have caret or not. BUG=n/a TEST=run-webkit-tests --gtest_filter=LocalFrameTest.nodeImage* ==========
PTAL - Update description - Introduce NodeImageBuilder class to encapsulate |updateDragState()| - Introduce gTest for regression and ":-webkit-drag" pseudo class >LayoutObjects can get destroyed in many places, This is the goal of this patch. During painting, |layoutObjects| should not be destroyed. I expect painting phase doesn't destroy layout object. Is my assumption false? If you see layout object destruction during paint phase, one of reasons is in editing about caret management. |BlockPainter::paint()| calls |LayoutObject::hasCaret()| and it can update layout tree due by |isEditingPosition()| which calls |Document::updateStyleAndLayoutTreeIgnorePendingStylesheets()| and layout tree is updated. This can be happened in |nodeImage()| since |updateDragState()| sets layout tree dirty. This patch blocks http://crrev.com/2089993003 https://codereview.chromium.org/2094653002/diff/1/third_party/WebKit/Source/c... File third_party/WebKit/Source/core/frame/LocalFrame.cpp (right): https://codereview.chromium.org/2094653002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/frame/LocalFrame.cpp:154: LayoutObject* const m_draggedLayoutObject; On 2016/06/23 at 20:29:13, pdr. wrote: > Why "LayoutObject* const" instead of "const LayoutObject*"? |m_layoutObject| is read-only member and |LayoutObject::updateDragState()| is non-const. https://codereview.chromium.org/2094653002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/frame/LocalFrame.cpp:606: // TODO(yosin): We should handle pseudo-class ":drag" as similar as On 2016/06/23 at 20:29:13, pdr. wrote: > I was a little confused by ":drag", I think we use ":-webkit-drag" Done. https://codereview.chromium.org/2094653002/diff/1/third_party/WebKit/Source/c... third_party/WebKit/Source/core/frame/LocalFrame.cpp:615: layoutObject->updateDragState(true); On 2016/06/23 at 20:29:13, pdr. wrote: > Previously, calling updateDragState was the responsibility of DragImageBuilder but now it's split in two places. Can these be unified (either all in this function or all in DragImageBuilder)? This will make it harder to forget to call updateDragState. > > One option would be to just update the return statement: > auto image = dragImageBuilder.createImage(); > if (layoutObject) > layoutObject->updateDragState(false); > return image; I introduce |NodeImageBuilder| class and make its ctor/dtor manage |updateDragState|.
Description was changed from ========== Make LocalFrame::nodeImage() to take an image for the element with :-webkit-drag pseudo class This patch makes |LocalFrame::nodeImage()| to take image for element with ":-webkit-drag" pseudo class by re-factoring |DragImageBuilder|. Before this patch, |nodeImage()| doesn't take ":-webkit-drag" and paints dragged element with dirty layout tree, e.g. |LayoutObject::updateDragState()| sets "Needs Style Recalc" for ":-webkit-drag". This causes layout tree update in |BlockPainter::paint()| due by |LayoutObject::hasCursor()| which calls |Document::updateStyleAndLayoutTreeIgnorePendingStylesheets()| via |isEditingPosition()|. This patch is a preparation of hoisting update layout for |isEditablePosition()| , http://crrev.com/2089993003, which is called during layout tree building for checking whether |LayoutBlock| have caret or not. BUG=n/a TEST=run-webkit-tests --gtest_filter=LocalFrameTest.nodeImage* ========== to ========== Make LocalFrame::nodeImage() to take an image for the element with :-webkit-drag pseudo class This patch makes |LocalFrame::nodeImage()| to take image for element with ":-webkit-drag" pseudo class by re-factoring |DragImageBuilder|. Before this patch, |nodeImage()| doesn't take ":-webkit-drag" and paints dragged element with dirty layout tree, e.g. |LayoutObject::updateDragState()| sets "Needs Style Recalc" for ":-webkit-drag". This causes layout tree update in |BlockPainter::paint()| due by |LayoutObject::hasCursor()| which calls |Document::updateStyleAndLayoutTreeIgnorePendingStylesheets()| via |isEditingPosition()|. This patch is a preparation of hoisting update layout for |isEditablePosition()| , http://crrev.com/2089993003, which is called during layout tree building for checking whether |LayoutBlock| have caret or not. BUG=623005 TEST=run-webkit-tests --gtest_filter=LocalFrameTest.nodeImage* ==========
On 2016/06/24 at 06:02:57, yosin wrote: > PTAL > > - Update description > - Introduce NodeImageBuilder class to encapsulate |updateDragState()| > - Introduce gTest for regression and ":-webkit-drag" pseudo class > > >LayoutObjects can get destroyed in many places, > > This is the goal of this patch. During painting, |layoutObjects| should not be destroyed. > I expect painting phase doesn't destroy layout object. Is my assumption false? > > If you see layout object destruction during paint phase, one of reasons is in editing about > caret management. |BlockPainter::paint()| calls |LayoutObject::hasCaret()| and it can update > layout tree due by |isEditingPosition()| which calls |Document::updateStyleAndLayoutTreeIgnorePendingStylesheets()| and layout tree is updated. This can be happened in |nodeImage()| since > |updateDragState()| sets layout tree dirty. > > This patch blocks http://crrev.com/2089993003 > > https://codereview.chromium.org/2094653002/diff/1/third_party/WebKit/Source/c... > File third_party/WebKit/Source/core/frame/LocalFrame.cpp (right): > > https://codereview.chromium.org/2094653002/diff/1/third_party/WebKit/Source/c... > third_party/WebKit/Source/core/frame/LocalFrame.cpp:154: LayoutObject* const m_draggedLayoutObject; > On 2016/06/23 at 20:29:13, pdr. wrote: > > Why "LayoutObject* const" instead of "const LayoutObject*"? > > |m_layoutObject| is read-only member and |LayoutObject::updateDragState()| is non-const. > > https://codereview.chromium.org/2094653002/diff/1/third_party/WebKit/Source/c... > third_party/WebKit/Source/core/frame/LocalFrame.cpp:606: // TODO(yosin): We should handle pseudo-class ":drag" as similar as > On 2016/06/23 at 20:29:13, pdr. wrote: > > I was a little confused by ":drag", I think we use ":-webkit-drag" > > Done. > > https://codereview.chromium.org/2094653002/diff/1/third_party/WebKit/Source/c... > third_party/WebKit/Source/core/frame/LocalFrame.cpp:615: layoutObject->updateDragState(true); > On 2016/06/23 at 20:29:13, pdr. wrote: > > Previously, calling updateDragState was the responsibility of DragImageBuilder but now it's split in two places. Can these be unified (either all in this function or all in DragImageBuilder)? This will make it harder to forget to call updateDragState. > > > > One option would be to just update the return statement: > > auto image = dragImageBuilder.createImage(); > > if (layoutObject) > > layoutObject->updateDragState(false); > > return image; > > I introduce |NodeImageBuilder| class and make its ctor/dtor manage |updateDragState|. Thanks, LGTM
The CQ bit was checked by yosin@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Committed patchset #2 (id:20001)
Message was sent while issue was closed.
Description was changed from ========== Make LocalFrame::nodeImage() to take an image for the element with :-webkit-drag pseudo class This patch makes |LocalFrame::nodeImage()| to take image for element with ":-webkit-drag" pseudo class by re-factoring |DragImageBuilder|. Before this patch, |nodeImage()| doesn't take ":-webkit-drag" and paints dragged element with dirty layout tree, e.g. |LayoutObject::updateDragState()| sets "Needs Style Recalc" for ":-webkit-drag". This causes layout tree update in |BlockPainter::paint()| due by |LayoutObject::hasCursor()| which calls |Document::updateStyleAndLayoutTreeIgnorePendingStylesheets()| via |isEditingPosition()|. This patch is a preparation of hoisting update layout for |isEditablePosition()| , http://crrev.com/2089993003, which is called during layout tree building for checking whether |LayoutBlock| have caret or not. BUG=623005 TEST=run-webkit-tests --gtest_filter=LocalFrameTest.nodeImage* ========== to ========== Make LocalFrame::nodeImage() to take an image for the element with :-webkit-drag pseudo class This patch makes |LocalFrame::nodeImage()| to take image for element with ":-webkit-drag" pseudo class by re-factoring |DragImageBuilder|. Before this patch, |nodeImage()| doesn't take ":-webkit-drag" and paints dragged element with dirty layout tree, e.g. |LayoutObject::updateDragState()| sets "Needs Style Recalc" for ":-webkit-drag". This causes layout tree update in |BlockPainter::paint()| due by |LayoutObject::hasCursor()| which calls |Document::updateStyleAndLayoutTreeIgnorePendingStylesheets()| via |isEditingPosition()|. This patch is a preparation of hoisting update layout for |isEditablePosition()| , http://crrev.com/2089993003, which is called during layout tree building for checking whether |LayoutBlock| have caret or not. BUG=623005 TEST=run-webkit-tests --gtest_filter=LocalFrameTest.nodeImage* Committed: https://crrev.com/0aad49f542b1119bf3ef413ca9c1c08d2aecb699 Cr-Commit-Position: refs/heads/master@{#402100} ==========
Message was sent while issue was closed.
Patchset 2 (id:??) landed as https://crrev.com/0aad49f542b1119bf3ef413ca9c1c08d2aecb699 Cr-Commit-Position: refs/heads/master@{#402100} |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
