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

Issue 20681004: Make first-letter style to work with editing

Created:
7 years, 4 months ago by yosin_UTC9
Modified:
7 years, 2 months ago
CC:
blink-reviews, dglazkov+blink, eae+blinkwatch, adamk+blink_chromium.org, jchaffraix+rendering, leviw+renderwatch
Visibility:
Public.

Description

Make first-letter style to work with editing This patch changes to consider a renderer for first letter with first-letter style is different from renderer associate to Node object, e.g. node->renderer(), for following actions to work: - Mouse click - Caret/Selection motion implemented in Position and VisiblePosition - Caret rendering - Selection range rendering For mouse click, this patch adds two function HitTestResult::renderer() and HitTestResult::setIsFirstLetter() to carry first letter hit from renderer to event handler. Note: Caching renderer in HitTestResult doesn't work because during event handling layout can be changed. For caret motion, this patch adds Position::rendererOfAnchorNode() and PostionIterator::renderer() to get renderer for first-letter when offset in DOM node points first letter rather than DOM node associate renderer. This change leads replacement from Position::anchorNode()->renderer() to Position::renderer() in Editor code and other use sites. For selection rendering, this patch changes FrameSelection::updateAppearance() to call RenderView::setSelection() with Postion::renderer() and Postion::offsetInRendererOfAnchorNode() Test file chagnes: * editing/deleting/merge-paragraph-with-first-letter.html Split(insert line break) a paragraph with first letter and merge(delete line break) to restore original state. * editing/selection/caret-with-first-letter.html Move caret around a first letter. * editing/selection/click-first-letter.html Set caret at first letter. Set caret at middle of text * editing/selection/extend-by-word-002.html Changed to JS test for portability with considering selection containing a first letter. * editing/selection/select-first-letter.html Check rendering selection range contains first-letter CSS property. * editing/text-iterator/first-letter-word-boundary.html First letter text fragment renderer contains two characters, a space and a letter. BUG=174349

Patch Set 1 : 2013-08-01T17:57:42 #

Total comments: 6

Patch Set 2 : 2013-08-02T13:47:24 #

Patch Set 3 : 2013-08-08T13:29:08 #

Total comments: 4

Patch Set 4 : 2013-09-20T18:27:32 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+567 lines, -332 lines) Patch
A LayoutTests/editing/deleting/merge-paragraph-with-first-letter.html View 1 chunk +43 lines, -0 lines 0 comments Download
A LayoutTests/editing/deleting/merge-paragraph-with-first-letter-expected.txt View 1 chunk +14 lines, -0 lines 0 comments Download
A LayoutTests/editing/selection/caret-with-first-letter.html View 1 chunk +78 lines, -0 lines 0 comments Download
A LayoutTests/editing/selection/caret-with-first-letter-expected.txt View 1 chunk +24 lines, -0 lines 0 comments Download
A LayoutTests/editing/selection/click-first-letter.html View 1 chunk +60 lines, -0 lines 0 comments Download
A LayoutTests/editing/selection/click-first-letter-expected.txt View 1 chunk +12 lines, -0 lines 0 comments Download
M LayoutTests/editing/selection/extend-by-word-002.html View 2 chunks +19 lines, -15 lines 0 comments Download
M LayoutTests/editing/selection/extend-by-word-002-expected.txt View 1 chunk +9 lines, -74 lines 0 comments Download
A LayoutTests/editing/selection/select-first-letter.html View 1 chunk +20 lines, -0 lines 0 comments Download
A LayoutTests/editing/selection/select-first-letter-expected.html View 1 chunk +12 lines, -0 lines 0 comments Download
D LayoutTests/platform/linux/editing/selection/extend-by-word-002-expected.png View Binary file 0 comments Download
D LayoutTests/platform/mac/editing/selection/extend-by-word-002-expected.png View 1 2 Binary file 0 comments Download
D LayoutTests/platform/win/editing/selection/extend-by-word-002-expected.png View Binary file 0 comments Download
D LayoutTests/platform/win/editing/selection/extend-by-word-002-expected.txt View 1 chunk +0 lines, -74 lines 0 comments Download
M Source/core/dom/Position.h View 1 2 3 1 chunk +7 lines, -0 lines 0 comments Download
M Source/core/dom/Position.cpp View 1 2 3 18 chunks +103 lines, -61 lines 1 comment Download
M Source/core/dom/PositionIterator.h View 2 chunks +3 lines, -0 lines 0 comments Download
M Source/core/dom/PositionIterator.cpp View 1 2 3 3 chunks +10 lines, -1 line 2 comments Download
M Source/core/editing/Caret.h View 1 2 2 chunks +6 lines, -5 lines 0 comments Download
M Source/core/editing/Caret.cpp View 1 2 3 9 chunks +26 lines, -33 lines 1 comment Download
M Source/core/editing/FrameSelection.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M Source/core/editing/FrameSelection.cpp View 1 2 3 7 chunks +16 lines, -20 lines 0 comments Download
M Source/core/editing/TextIterator.cpp View 1 2 3 2 chunks +2 lines, -15 lines 0 comments Download
M Source/core/editing/VisiblePosition.cpp View 1 2 3 4 chunks +6 lines, -3 lines 0 comments Download
M Source/core/editing/VisibleUnits.cpp View 1 2 3 2 chunks +6 lines, -6 lines 0 comments Download
M Source/core/editing/htmlediting.cpp View 1 2 3 3 chunks +9 lines, -3 lines 0 comments Download
M Source/core/page/EventHandler.cpp View 1 2 3 13 chunks +25 lines, -19 lines 0 comments Download
M Source/core/rendering/HitTestResult.h View 4 chunks +5 lines, -0 lines 0 comments Download
M Source/core/rendering/HitTestResult.cpp View 1 2 3 6 chunks +18 lines, -1 line 0 comments Download
M Source/core/rendering/RenderText.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/rendering/RenderText.cpp View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M Source/core/rendering/RenderTextFragment.h View 1 2 chunks +3 lines, -0 lines 0 comments Download
M Source/core/rendering/RenderTextFragment.cpp View 1 3 chunks +27 lines, -0 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
yosin_UTC9
Hi, Could you review this patch? Thanks in advance. P.S. Mac and Win bots failures ...
7 years, 4 months ago (2013-08-02 01:22:18 UTC) #1
tkent
This looks workable, but I'm not confident that the design is good. I'd like to ...
7 years, 4 months ago (2013-08-02 02:22:18 UTC) #2
tkent
https://codereview.chromium.org/20681004/diff/41001/Source/core/rendering/RenderTextFragment.cpp File Source/core/rendering/RenderTextFragment.cpp (right): https://codereview.chromium.org/20681004/diff/41001/Source/core/rendering/RenderTextFragment.cpp#newcode59 Source/core/rendering/RenderTextFragment.cpp:59: if (RenderText* found = findRenderText(current)) Using RenderObject::nextInPreOrder is preferable ...
7 years, 4 months ago (2013-08-02 03:25:48 UTC) #3
yosin_UTC9
Updated. PTAL https://codereview.chromium.org/20681004/diff/41001/Source/core/rendering/RenderText.cpp File Source/core/rendering/RenderText.cpp (right): https://codereview.chromium.org/20681004/diff/41001/Source/core/rendering/RenderText.cpp#newcode531 Source/core/rendering/RenderText.cpp:531: return box->renderer()->createPositionWithAffinity(offset + toRenderText(box->renderer())->textStartOffset(), affinity); On 2013/08/02 ...
7 years, 4 months ago (2013-08-02 05:01:55 UTC) #4
yosin_UTC9
Updated for Caret.{cpp,h} spawned from FrameSelection.{cpp,h} Could you review this patch? Thanks in advance.
7 years, 4 months ago (2013-08-08 04:34:01 UTC) #5
yosin_UTC9
+eseidel +leviw 4 weeks passed since the last message. Could you review this patch? Thanks ...
7 years, 3 months ago (2013-09-06 08:18:18 UTC) #6
eseidel
Ojan is much more up to date with this code than I. I thought that ...
7 years, 3 months ago (2013-09-09 20:28:26 UTC) #7
eseidel
Also, please squeak louder. Start scheduling meetings on my or Ojan's calendar if need be. ...
7 years, 3 months ago (2013-09-09 20:29:11 UTC) #8
ojan
Can you split the hit testing and caret-motion parts of this into different patches? It's ...
7 years, 3 months ago (2013-09-12 23:54:38 UTC) #9
yosin_UTC9
On 2013/09/12 23:54:38, ojan wrote: > Can you split the hit testing and caret-motion parts ...
7 years, 3 months ago (2013-09-20 08:54:01 UTC) #10
yosin_UTC9
PTAL https://codereview.chromium.org/20681004/diff/59001/Source/core/dom/Position.cpp File Source/core/dom/Position.cpp (right): https://codereview.chromium.org/20681004/diff/59001/Source/core/dom/Position.cpp#newcode464 Source/core/dom/Position.cpp:464: RenderObject* renderer = m_anchorNode->renderer(); On 2013/09/09 20:28:27, eseidel ...
7 years, 3 months ago (2013-09-20 09:30:26 UTC) #11
ojan
It's very difficult to review such a large patch...I did my best. https://codereview.chromium.org/20681004/diff/82001/Source/core/dom/Position.cpp File Source/core/dom/Position.cpp ...
7 years, 2 months ago (2013-09-23 23:01:44 UTC) #12
yosin_UTC9
7 years, 2 months ago (2013-10-04 10:27:13 UTC) #13
I make another patch for hit testing part, because I found how to test it:
https://codereview.chromium.org/25668008/

Powered by Google App Engine
This is Rietveld 408576698