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

Side by Side Diff: sky/sdk/lib/framework/layout2.dart

Issue 1155103003: Move RenderParagraph into layout2.dart (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « sky/examples/raw/render_paragraph.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 import 'node.dart'; 5 import 'node.dart';
6 import 'dart:sky' as sky; 6 import 'dart:sky' as sky;
7 7
8 // ABSTRACT LAYOUT 8 // ABSTRACT LAYOUT
9 9
10 class ParentData { 10 class ParentData {
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 void markNeedsPaint() { 181 void markNeedsPaint() {
182 assert(!_debugDoingPaint); 182 assert(!_debugDoingPaint);
183 // TODO(abarth): It's very redundant to call this for every node in the 183 // TODO(abarth): It's very redundant to call this for every node in the
184 // render tree during layout. We should instead compute a summary bit and 184 // render tree during layout. We should instead compute a summary bit and
185 // call it once at the end of layout. 185 // call it once at the end of layout.
186 sky.view.scheduleFrame(); 186 sky.view.scheduleFrame();
187 } 187 }
188 void paint(RenderNodeDisplayList canvas) { } 188 void paint(RenderNodeDisplayList canvas) { }
189 189
190 190
191 // HIT TESTING 191 // HIT TESTING
192 192
193 void handlePointer(sky.PointerEvent event) { 193 void handlePointer(sky.PointerEvent event) {
194 // override this if you have a client, to hand it to the client 194 // override this if you have a client, to hand it to the client
195 // override this if you want to do anything with the pointer event 195 // override this if you want to do anything with the pointer event
196 } 196 }
197 197
198 // RenderNode subclasses are expected to have a method like the 198 // RenderNode subclasses are expected to have a method like the
199 // following (with the signature being whatever passes for coordinates 199 // following (with the signature being whatever passes for coordinates
200 // for this particular class): 200 // for this particular class):
201 // bool hitTest(HitTestResult result, { double x, double y }) { 201 // bool hitTest(HitTestResult result, { double x, double y }) {
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 915
916 void hitTestChildren(HitTestResult result, { double x, double y }) { 916 void hitTestChildren(HitTestResult result, { double x, double y }) {
917 defaultHitTestChildren(result, x: x, y: y); 917 defaultHitTestChildren(result, x: x, y: y);
918 } 918 }
919 919
920 void paint(RenderNodeDisplayList canvas) { 920 void paint(RenderNodeDisplayList canvas) {
921 super.paint(canvas); 921 super.paint(canvas);
922 defaultPaint(canvas); 922 defaultPaint(canvas);
923 } 923 }
924 } 924 }
925
926 class RenderParagraph extends RenderDecoratedBox {
927 final String text;
928 LayoutRoot _layoutRoot = new LayoutRoot();
929 Document _document;
930
931 RenderParagraph(String this.text) :
932 super(new BoxDecoration(backgroundColor: 0xFFFFFFFF)) {
933 _document = new Document();
934 _layoutRoot.rootElement = _document.createElement('p');
935 _layoutRoot.rootElement.appendChild(_document.createText(this.text));
936 }
937
938 void performLayout() {
939 _layoutRoot.maxWidth = constraints.maxWidth;
940 _layoutRoot.minWidth = constraints.minWidth;
941 _layoutRoot.layout();
942 width = _layoutRoot.rootElement.width;
943 height = _layoutRoot.rootElement.height;
944 }
945
946 void hitTestChildren(HitTestResult result, { double x, double y }) {
947 // defaultHitTestChildren(result, x: x, y: y);
948 }
949
950 void paint(RenderNodeDisplayList canvas) {
951 super.paint(canvas);
952 _layoutRoot.paint(canvas);
953 }
954 }
OLDNEW
« no previous file with comments | « sky/examples/raw/render_paragraph.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698