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

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

Issue 1805283002: [SPv2] Fix paint offset computation for LayoutTableCell in property tree builder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp » ('j') | 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 #include "core/paint/PaintPropertyTreeBuilder.h" 5 #include "core/paint/PaintPropertyTreeBuilder.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/layout/LayoutPart.h" 8 #include "core/layout/LayoutPart.h"
9 #include "core/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "core/paint/ObjectPaintProperties.h" 10 #include "core/paint/ObjectPaintProperties.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 walk(*layoutView, localContext); 100 walk(*layoutView, localContext);
101 } 101 }
102 102
103 static void deriveBorderBoxFromContainerContext(const LayoutObject& object, Pain tPropertyTreeBuilderContext& context) 103 static void deriveBorderBoxFromContainerContext(const LayoutObject& object, Pain tPropertyTreeBuilderContext& context)
104 { 104 {
105 if (!object.isBoxModelObject()) 105 if (!object.isBoxModelObject())
106 return; 106 return;
107 107
108 const LayoutBoxModelObject& boxModelObject = toLayoutBoxModelObject(object); 108 const LayoutBoxModelObject& boxModelObject = toLayoutBoxModelObject(object);
109 109
110 // TODO(trchen): There is some insanity going on with tables. Double check r esults.
111 switch (object.styleRef().position()) { 110 switch (object.styleRef().position()) {
112 case StaticPosition: 111 case StaticPosition:
113 break; 112 break;
114 case RelativePosition: 113 case RelativePosition:
115 context.paintOffset += boxModelObject.offsetForInFlowPosition(); 114 context.paintOffset += boxModelObject.offsetForInFlowPosition();
116 break; 115 break;
117 case AbsolutePosition: 116 case AbsolutePosition:
118 context.currentTransform = context.transformForAbsolutePosition; 117 context.currentTransform = context.transformForAbsolutePosition;
119 context.paintOffset = context.paintOffsetForAbsolutePosition; 118 context.paintOffset = context.paintOffsetForAbsolutePosition;
120 context.currentClip = context.clipForAbsolutePosition; 119 context.currentClip = context.clipForAbsolutePosition;
121 break; 120 break;
122 case StickyPosition: 121 case StickyPosition:
123 context.paintOffset += boxModelObject.offsetForInFlowPosition(); 122 context.paintOffset += boxModelObject.offsetForInFlowPosition();
124 break; 123 break;
125 case FixedPosition: 124 case FixedPosition:
126 context.currentTransform = context.transformForFixedPosition; 125 context.currentTransform = context.transformForFixedPosition;
127 context.paintOffset = context.paintOffsetForFixedPosition; 126 context.paintOffset = context.paintOffsetForFixedPosition;
128 context.currentClip = context.clipForFixedPosition; 127 context.currentClip = context.clipForFixedPosition;
129 break; 128 break;
130 default: 129 default:
131 ASSERT_NOT_REACHED(); 130 ASSERT_NOT_REACHED();
132 } 131 }
133 if (boxModelObject.isBox()) 132 if (boxModelObject.isBox()) {
134 context.paintOffset += toLayoutBox(boxModelObject).locationOffset(); 133 context.paintOffset += toLayoutBox(boxModelObject).locationOffset();
134 // This is a weird quirk that table cells paint as children of table row s,
135 // but their location have the row's location baked-in.
136 // Similar adjustment is done in LayoutTableCell::offsetFromContainer().
137 if (boxModelObject.isTableCell()) {
138 LayoutObject* parentRow = boxModelObject.parent();
139 ASSERT(parentRow && parentRow->isTableRow());
140 context.paintOffset -= toLayoutBox(parentRow)->locationOffset();
141 }
142 }
135 } 143 }
136 144
137 static PassRefPtr<TransformPaintPropertyNode> createPaintOffsetTranslationIfNeed ed(const LayoutObject& object, PaintPropertyTreeBuilderContext& context) 145 static PassRefPtr<TransformPaintPropertyNode> createPaintOffsetTranslationIfNeed ed(const LayoutObject& object, PaintPropertyTreeBuilderContext& context)
138 { 146 {
139 bool shouldCreatePaintOffsetTranslationNode = false; 147 bool shouldCreatePaintOffsetTranslationNode = false;
140 if (object.isSVGRoot()) { 148 if (object.isSVGRoot()) {
141 // SVG doesn't use paint offset internally so emit a paint offset at the html->svg boundary. 149 // SVG doesn't use paint offset internally so emit a paint offset at the html->svg boundary.
142 shouldCreatePaintOffsetTranslationNode = true; 150 shouldCreatePaintOffsetTranslationNode = true;
143 } else if (object.isBoxModelObject()) { 151 } else if (object.isBoxModelObject()) {
144 // TODO(trchen): Eliminate PaintLayer dependency. 152 // TODO(trchen): Eliminate PaintLayer dependency.
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 385
378 if (object.isLayoutPart()) { 386 if (object.isLayoutPart()) {
379 Widget* widget = toLayoutPart(object).widget(); 387 Widget* widget = toLayoutPart(object).widget();
380 if (widget && widget->isFrameView()) 388 if (widget && widget->isFrameView())
381 walk(*toFrameView(widget), localContext); 389 walk(*toFrameView(widget), localContext);
382 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281). 390 // TODO(pdr): Investigate RemoteFrameView (crbug.com/579281).
383 } 391 }
384 } 392 }
385 393
386 } // namespace blink 394 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698