Chromium Code Reviews
Help | Chromium Project | Gerrit Changes | Sign in
(17)

Issue 1188693005: Introduce StyledMarkupTraverser to StyledMarkupSerializer (Closed)

Created:
4 years, 10 months ago by hajimehoshi
Modified:
4 years, 10 months ago
Reviewers:
tkent, yosin_UTC9
CC:
blink-reviews, blink-reviews-style_chromium.org, yosin_UTC9
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Introduce StyledMarkupTraverser to StyledMarkupSerializer We are now going to have StyledMarkupSerializer work on the Composed tree. We found just templatizing StyledMarkupSerializer was not enough. As for traversing a node tree, even though you start to traverse a tree in a composed-tree strategy, you would need to 'switch' the strategy to a dom-tree strategy when you find a closed-shadow host. For example, a <select> element is now a closed shadow host, but traversing <select> element as a composed tree doesn't make sense (a <div> or something would be in your clipboard). This means we need to call the DOM version of traverseNodesForSerialization in the Composed tree version of that. As a preparation, this CL introduces StyledMarkupTraverser which implements traverseNodesForSerialization so that we can call traverseNodesForSerialization in traverseNodesForSerialization with a different editing strategy. I am going to fix traverseNodesForSerialization later to do so. This patch is result of collaboration work with yosin@chromium.org for selection of web components. We've already prepared the new node-traversal usages at crrev.com/1188063002. BUG=275851 TEST=n/a; no behavior change Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=197322

Patch Set 1 #

Patch Set 2 : #

Total comments: 22

Patch Set 3 : yosin's review #

Patch Set 4 : rebase #

Patch Set 5 : Renamed StyledMarkupTraverser #

Total comments: 4

Patch Set 6 : yosin's review #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+109 lines, -53 lines) Patch
M Source/core/editing/StyledMarkupAccumulator.h View 1 3 chunks +5 lines, -2 lines 0 comments Download
M Source/core/editing/StyledMarkupAccumulator.cpp View 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/editing/StyledMarkupSerializer.h View 1 2 chunks +0 lines, -11 lines 0 comments Download
M Source/core/editing/StyledMarkupSerializer.cpp View 1 2 3 4 5 13 chunks +102 lines, -39 lines 2 comments Download

Messages

Total messages: 17 (2 generated)
hajimehoshi
PTAL
4 years, 10 months ago (2015-06-17 10:51:39 UTC) #2
yosin_UTC9
https://codereview.chromium.org/1188693005/diff/20001/Source/core/editing/StyledMarkupSerializer.cpp File Source/core/editing/StyledMarkupSerializer.cpp (right): https://codereview.chromium.org/1188693005/diff/20001/Source/core/editing/StyledMarkupSerializer.cpp#newcode71 Source/core/editing/StyledMarkupSerializer.cpp:71: Traverser(StyledMarkupAccumulator* accumulator, Node* lastClosed) How about moving this ctor ...
4 years, 10 months ago (2015-06-17 13:07:58 UTC) #3
yosin_UTC9
https://codereview.chromium.org/1188693005/diff/20001/Source/core/editing/StyledMarkupSerializer.cpp File Source/core/editing/StyledMarkupSerializer.cpp (right): https://codereview.chromium.org/1188693005/diff/20001/Source/core/editing/StyledMarkupSerializer.cpp#newcode76 Source/core/editing/StyledMarkupSerializer.cpp:76: m_wrappingStyle = EditingStyle::wrappingStyleForSerialization(Strategy::parent(*m_lastClosed), m_accumulator->shouldAnnotate()); Since, we use |m_accumulator->shouldAnnotate()| four ...
4 years, 10 months ago (2015-06-17 13:31:02 UTC) #4
yosin_UTC9
https://codereview.chromium.org/1188693005/diff/20001/Source/core/editing/StyledMarkupSerializer.cpp File Source/core/editing/StyledMarkupSerializer.cpp (right): https://codereview.chromium.org/1188693005/diff/20001/Source/core/editing/StyledMarkupSerializer.cpp#newcode353 Source/core/editing/StyledMarkupSerializer.cpp:353: if (m_accumulator->convertBlocksToInlines() && isBlock(&node)) We have two |m_accumulator->convertBlocksToInlines()|, so ...
4 years, 10 months ago (2015-06-17 14:06:28 UTC) #5
yosin_UTC9
https://codereview.chromium.org/1188693005/diff/20001/Source/core/editing/StyledMarkupSerializer.cpp File Source/core/editing/StyledMarkupSerializer.cpp (right): https://codereview.chromium.org/1188693005/diff/20001/Source/core/editing/StyledMarkupSerializer.cpp#newcode337 Source/core/editing/StyledMarkupSerializer.cpp:337: if (shouldApplyWrappingStyle(element) || needsInlineStyle(element)) Note: in ALL-IN-ONE, we check ...
4 years, 10 months ago (2015-06-17 14:33:07 UTC) #6
hajimehoshi
Thank you! https://codereview.chromium.org/1188693005/diff/20001/Source/core/editing/StyledMarkupSerializer.cpp File Source/core/editing/StyledMarkupSerializer.cpp (right): https://codereview.chromium.org/1188693005/diff/20001/Source/core/editing/StyledMarkupSerializer.cpp#newcode71 Source/core/editing/StyledMarkupSerializer.cpp:71: Traverser(StyledMarkupAccumulator* accumulator, Node* lastClosed) On 2015/06/17 13:07:57, ...
4 years, 10 months ago (2015-06-18 02:04:56 UTC) #7
yosin_UTC9
https://codereview.chromium.org/1188693005/diff/80001/Source/core/editing/StyledMarkupSerializer.cpp File Source/core/editing/StyledMarkupSerializer.cpp (right): https://codereview.chromium.org/1188693005/diff/80001/Source/core/editing/StyledMarkupSerializer.cpp#newcode182 Source/core/editing/StyledMarkupSerializer.cpp:182: Node* lastClosed = traverser.traverseNodesForSerialization(firstNode, pastEnd); s/traverseNodesForSerialization/serializeNodes/ or s/traverseNodesForSerialization/traverse/ or ...
4 years, 10 months ago (2015-06-18 05:13:29 UTC) #8
hajimehoshi
Thank you! https://codereview.chromium.org/1188693005/diff/80001/Source/core/editing/StyledMarkupSerializer.cpp File Source/core/editing/StyledMarkupSerializer.cpp (right): https://codereview.chromium.org/1188693005/diff/80001/Source/core/editing/StyledMarkupSerializer.cpp#newcode182 Source/core/editing/StyledMarkupSerializer.cpp:182: Node* lastClosed = traverser.traverseNodesForSerialization(firstNode, pastEnd); On 2015/06/18 ...
4 years, 10 months ago (2015-06-18 05:24:55 UTC) #9
yosin_UTC9
I'm OK with this patch. Since, I'm co-author of this patch. So, I'm not a ...
4 years, 10 months ago (2015-06-18 06:06:57 UTC) #10
tkent
rslgtm.
4 years, 10 months ago (2015-06-18 06:10:49 UTC) #11
tkent
lgtm.
4 years, 10 months ago (2015-06-18 06:11:15 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1188693005/90001
4 years, 10 months ago (2015-06-18 06:15:23 UTC) #14
commit-bot: I haz the power
Committed patchset #6 (id:90001) as https://src.chromium.org/viewvc/blink?view=rev&revision=197322
4 years, 10 months ago (2015-06-18 06:26:54 UTC) #15
yosin_UTC9
https://codereview.chromium.org/1188693005/diff/90001/Source/core/editing/StyledMarkupSerializer.cpp File Source/core/editing/StyledMarkupSerializer.cpp (right): https://codereview.chromium.org/1188693005/diff/90001/Source/core/editing/StyledMarkupSerializer.cpp#newcode255 Source/core/editing/StyledMarkupSerializer.cpp:255: ASSERT(m_lastClosed); |m_lastClosed| can be |nullptr| according to Patch Set ...
4 years, 10 months ago (2015-06-18 13:28:51 UTC) #16
hajimehoshi
4 years, 10 months ago (2015-06-19 04:25:08 UTC) #17
Message was sent while issue was closed.
https://codereview.chromium.org/1188693005/diff/90001/Source/core/editing/Sty...
File Source/core/editing/StyledMarkupSerializer.cpp (right):

https://codereview.chromium.org/1188693005/diff/90001/Source/core/editing/Sty...
Source/core/editing/StyledMarkupSerializer.cpp:255: ASSERT(m_lastClosed);
On 2015/06/18 13:28:51, Yosi_UTC9 wrote:
> |m_lastClosed| can be |nullptr| according to Patch Set 4. Is it OK to change
to
> ASSERT?

Good point. I'll fix this.

Powered by Google App Engine
This is Rietveld 408576698