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

Side by Side Diff: third_party/WebKit/Source/core/paint/NGTextPainter.cpp

Issue 2842983002: [LayoutNG] Paint inlines from the fragment tree
Patch Set: Rebase w/HEAD 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/paint/NGTextPainter.h"
6
7 #include "core/CSSPropertyNames.h"
8 #include "core/frame/Settings.h"
9 #include "core/layout/ng/inline/ng_physical_text_fragment.h"
10 #include "core/paint/BoxPainter.h"
11 #include "core/paint/PaintInfo.h"
12 #include "core/style/ComputedStyle.h"
13 #include "core/style/ShadowList.h"
14 #include "platform/fonts/Font.h"
15 #include "platform/graphics/GraphicsContext.h"
16 #include "platform/graphics/GraphicsContextStateSaver.h"
17 #include "platform/wtf/Assertions.h"
18 #include "platform/wtf/text/CharacterNames.h"
19
20 namespace blink {
21
22 void NGTextPainter::Paint(unsigned start_offset,
23 unsigned end_offset,
24 unsigned length,
25 const Style& text_style) {
26 GraphicsContextStateSaver state_saver(graphics_context_, false);
27 UpdateGraphicsContext(text_style, state_saver);
28 // if (combined_text_) {
29 // graphics_context_.Save();
30 // combined_text_->TransformToInlineCoordinates(graphics_context_,
31 // text_bounds_);
32 // PaintInternal<kPaintText>(start_offset, end_offset, length);
33 // graphics_context_.Restore();
34 //} else {
35 PaintInternal<kPaintText>(start_offset, end_offset, length);
36 //}
37
38 // if (!emphasis_mark_.IsEmpty()) {
39 // if (text_style.emphasis_mark_color != text_style.fill_color)
40 // graphics_context_.SetFillColor(text_style.emphasis_mark_color);
41 //
42 // if (combined_text_)
43 // PaintEmphasisMarkForCombinedText();
44 // else
45 // PaintInternal<kPaintEmphasisMark>(start_offset, end_offset, length);
46 //}
47 }
48
49 template <NGTextPainter::PaintInternalStep step>
50 void NGTextPainter::PaintInternalFragment(
51 TextFragmentPaintInfo& fragment_paint_info,
52 unsigned from,
53 unsigned to) {
54 DCHECK(from <= fragment_paint_info.text.length());
55 DCHECK(to <= fragment_paint_info.text.length());
56
57 fragment_paint_info.from = from;
58 fragment_paint_info.to = to;
59
60 if (step == kPaintEmphasisMark) {
61 graphics_context_.DrawEmphasisMarks(
62 font_, fragment_paint_info, emphasis_mark_,
63 FloatPoint(text_origin_) + IntSize(0, emphasis_mark_offset_));
64 } else {
65 DCHECK(step == kPaintText);
66 graphics_context_.DrawText(font_, fragment_paint_info,
67 FloatPoint(text_origin_));
68 }
69 }
70
71 template <NGTextPainter::PaintInternalStep Step>
72 void NGTextPainter::PaintInternal(unsigned start_offset,
73 unsigned end_offset,
74 unsigned truncation_point) {
75 unsigned offset = 0;
76 TextFragmentPaintInfo fragment_paint_info = {
77 text_fragment_->Text(), TextDirection::kLtr, offset,
78 text_fragment_->Text().length(), text_fragment_->TextShapeResult()};
79
80 // fragment_paint_info.bounds = FloatRect(text_bounds_);
81 if (start_offset <= end_offset) {
82 PaintInternalFragment<Step>(fragment_paint_info, start_offset, end_offset);
83 } else {
84 if (end_offset > 0) {
85 PaintInternalFragment<Step>(fragment_paint_info, ellipsis_offset_,
86 end_offset);
87 }
88 if (start_offset < truncation_point) {
89 PaintInternalFragment<Step>(fragment_paint_info, start_offset,
90 truncation_point);
91 }
92 }
93 }
94
95 void NGTextPainter::ClipDecorationsStripe(float upper,
96 float stripe_width,
97 float dilation) {}
98
99 void NGTextPainter::PaintEmphasisMarkForCombinedText() {}
100
101 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/NGTextPainter.h ('k') | third_party/WebKit/Source/core/paint/RoundedInnerRectClipper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698