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

Side by Side Diff: Source/core/layout/LayoutFrameSet.cpp

Issue 929223003: Move and rename RenderFrame and RenderFrameSet. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 | « Source/core/layout/LayoutFrameSet.h ('k') | Source/core/layout/LayoutPart.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /** 1 /**
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Simon Hausmann <hausmann@kde.org> 3 * (C) 2000 Simon Hausmann <hausmann@kde.org>
4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de) 4 * (C) 2000 Stefan Schimanski (1Stein@gmx.de)
5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 5 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
11 * 11 *
12 * This library is distributed in the hope that it will be useful, 12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details. 15 * Library General Public License for more details.
16 * 16 *
17 * You should have received a copy of the GNU Library General Public License 17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to 18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA. 20 * Boston, MA 02110-1301, USA.
21 * 21 *
22 */ 22 */
23 23
24 #include "config.h" 24 #include "config.h"
25 #include "core/rendering/RenderFrameSet.h" 25 #include "core/layout/LayoutFrameSet.h"
26 26
27 #include "core/dom/Document.h" 27 #include "core/dom/Document.h"
28 #include "core/events/MouseEvent.h" 28 #include "core/events/MouseEvent.h"
29 #include "core/frame/LocalFrame.h" 29 #include "core/frame/LocalFrame.h"
30 #include "core/html/HTMLDimension.h" 30 #include "core/html/HTMLDimension.h"
31 #include "core/html/HTMLFrameSetElement.h" 31 #include "core/html/HTMLFrameSetElement.h"
32 #include "core/layout/LayoutFrame.h"
32 #include "core/layout/PaintInfo.h" 33 #include "core/layout/PaintInfo.h"
33 #include "core/page/EventHandler.h" 34 #include "core/page/EventHandler.h"
34 #include "core/paint/FrameSetPainter.h" 35 #include "core/paint/FrameSetPainter.h"
35 #include "core/rendering/RenderFrame.h"
36 #include "core/rendering/RenderView.h" 36 #include "core/rendering/RenderView.h"
37 #include "platform/Cursor.h" 37 #include "platform/Cursor.h"
38 #include "platform/graphics/GraphicsContext.h" 38 #include "platform/graphics/GraphicsContext.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 RenderFrameSet::RenderFrameSet(HTMLFrameSetElement* frameSet) 42 LayoutFrameSet::LayoutFrameSet(HTMLFrameSetElement* frameSet)
43 : RenderBox(frameSet) 43 : RenderBox(frameSet)
44 , m_isResizing(false) 44 , m_isResizing(false)
45 , m_isChildResizing(false) 45 , m_isChildResizing(false)
46 { 46 {
47 setInline(false); 47 setInline(false);
48 } 48 }
49 49
50 RenderFrameSet::~RenderFrameSet() 50 LayoutFrameSet::~LayoutFrameSet()
51 { 51 {
52 } 52 }
53 53
54 RenderFrameSet::GridAxis::GridAxis() 54 LayoutFrameSet::GridAxis::GridAxis()
55 : m_splitBeingResized(noSplit) 55 : m_splitBeingResized(noSplit)
56 { 56 {
57 } 57 }
58 58
59 HTMLFrameSetElement* RenderFrameSet::frameSet() const 59 HTMLFrameSetElement* LayoutFrameSet::frameSet() const
60 { 60 {
61 return toHTMLFrameSetElement(node()); 61 return toHTMLFrameSetElement(node());
62 } 62 }
63 63
64 void RenderFrameSet::paint(const PaintInfo& paintInfo, const LayoutPoint& paintO ffset) 64 void LayoutFrameSet::paint(const PaintInfo& paintInfo, const LayoutPoint& paintO ffset)
65 { 65 {
66 FrameSetPainter(*this).paint(paintInfo, paintOffset); 66 FrameSetPainter(*this).paint(paintInfo, paintOffset);
67 } 67 }
68 68
69 void RenderFrameSet::computePreferredLogicalWidths() 69 void LayoutFrameSet::computePreferredLogicalWidths()
70 { 70 {
71 m_minPreferredLogicalWidth = 0; 71 m_minPreferredLogicalWidth = 0;
72 m_maxPreferredLogicalWidth = 0; 72 m_maxPreferredLogicalWidth = 0;
73 clearPreferredLogicalWidthsDirty(); 73 clearPreferredLogicalWidthsDirty();
74 } 74 }
75 75
76 void RenderFrameSet::GridAxis::resize(int size) 76 void LayoutFrameSet::GridAxis::resize(int size)
77 { 77 {
78 m_sizes.resize(size); 78 m_sizes.resize(size);
79 m_deltas.resize(size); 79 m_deltas.resize(size);
80 m_deltas.fill(0); 80 m_deltas.fill(0);
81 81
82 // To track edges for resizability and borders, we need to be (size + 1). Th is is because a parent frameset 82 // To track edges for resizability and borders, we need to be (size + 1). Th is is because a parent frameset
83 // may ask us for information about our left/top/right/bottom edges in order to make its own decisions about 83 // may ask us for information about our left/top/right/bottom edges in order to make its own decisions about
84 // what to do. We are capable of tainting that parent frameset's borders, so we have to cache this info. 84 // what to do. We are capable of tainting that parent frameset's borders, so we have to cache this info.
85 m_preventResize.resize(size + 1); 85 m_preventResize.resize(size + 1);
86 m_allowBorder.resize(size + 1); 86 m_allowBorder.resize(size + 1);
87 } 87 }
88 88
89 void RenderFrameSet::layOutAxis(GridAxis& axis, const Vector<HTMLDimension>& gri d, int availableLen) 89 void LayoutFrameSet::layOutAxis(GridAxis& axis, const Vector<HTMLDimension>& gri d, int availableLen)
90 { 90 {
91 availableLen = max(availableLen, 0); 91 availableLen = max(availableLen, 0);
92 92
93 int* gridLayout = axis.m_sizes.data(); 93 int* gridLayout = axis.m_sizes.data();
94 94
95 if (grid.isEmpty()) { 95 if (grid.isEmpty()) {
96 gridLayout[0] = availableLen; 96 gridLayout[0] = availableLen;
97 return; 97 return;
98 } 98 }
99 99
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // columns/rows we need to proportionally adjust their size. 140 // columns/rows we need to proportionally adjust their size.
141 if (totalFixed > remainingLen) { 141 if (totalFixed > remainingLen) {
142 int remainingFixed = remainingLen; 142 int remainingFixed = remainingLen;
143 143
144 for (int i = 0; i < gridLen; ++i) { 144 for (int i = 0; i < gridLen; ++i) {
145 if (grid[i].isAbsolute()) { 145 if (grid[i].isAbsolute()) {
146 gridLayout[i] = (gridLayout[i] * remainingFixed) / totalFixed; 146 gridLayout[i] = (gridLayout[i] * remainingFixed) / totalFixed;
147 remainingLen -= gridLayout[i]; 147 remainingLen -= gridLayout[i];
148 } 148 }
149 } 149 }
150 } else 150 } else {
151 remainingLen -= totalFixed; 151 remainingLen -= totalFixed;
152 }
152 153
153 // Percentage columns/rows are our second priority. Divide the remaining spa ce proportionally 154 // Percentage columns/rows are our second priority. Divide the remaining spa ce proportionally
154 // over all percentage columns/rows. IMPORTANT: the size of each column/row is not relative 155 // over all percentage columns/rows. IMPORTANT: the size of each column/row is not relative
155 // to 100%, but to the total percentage. For example, if there are three col umns, each of 75%, 156 // to 100%, but to the total percentage. For example, if there are three col umns, each of 75%,
156 // and the available space is 300px, each column will become 100px in width. 157 // and the available space is 300px, each column will become 100px in width.
157 if (totalPercent > remainingLen) { 158 if (totalPercent > remainingLen) {
158 int remainingPercent = remainingLen; 159 int remainingPercent = remainingLen;
159 160
160 for (int i = 0; i < gridLen; ++i) { 161 for (int i = 0; i < gridLen; ++i) {
161 if (grid[i].isPercentage()) { 162 if (grid[i].isPercentage()) {
162 gridLayout[i] = (gridLayout[i] * remainingPercent) / totalPercen t; 163 gridLayout[i] = (gridLayout[i] * remainingPercent) / totalPercen t;
163 remainingLen -= gridLayout[i]; 164 remainingLen -= gridLayout[i];
164 } 165 }
165 } 166 }
166 } else 167 } else {
167 remainingLen -= totalPercent; 168 remainingLen -= totalPercent;
169 }
168 170
169 // Relative columns/rows are our last priority. Divide the remaining space p roportionally 171 // Relative columns/rows are our last priority. Divide the remaining space p roportionally
170 // over all relative columns/rows. IMPORTANT: the relative value of 0* is tr eated as 1*. 172 // over all relative columns/rows. IMPORTANT: the relative value of 0* is tr eated as 1*.
171 if (countRelative) { 173 if (countRelative) {
172 int lastRelative = 0; 174 int lastRelative = 0;
173 int remainingRelative = remainingLen; 175 int remainingRelative = remainingLen;
174 176
175 for (int i = 0; i < gridLen; ++i) { 177 for (int i = 0; i < gridLen; ++i) {
176 if (grid[i].isRelative()) { 178 if (grid[i].isRelative()) {
177 gridLayout[i] = (max(grid[i].value(), 1.) * remainingRelative) / totalRelative; 179 gridLayout[i] = (max(grid[i].value(), 1.) * remainingRelative) / totalRelative;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 gridLayout[i] += gridDelta[i]; 272 gridLayout[i] += gridDelta[i];
271 } 273 }
272 // if the deltas broke something, undo them 274 // if the deltas broke something, undo them
273 if (!worked) { 275 if (!worked) {
274 for (int i = 0; i < gridLen; ++i) 276 for (int i = 0; i < gridLen; ++i)
275 gridLayout[i] -= gridDelta[i]; 277 gridLayout[i] -= gridDelta[i];
276 axis.m_deltas.fill(0); 278 axis.m_deltas.fill(0);
277 } 279 }
278 } 280 }
279 281
280 void RenderFrameSet::notifyFrameEdgeInfoChanged() 282 void LayoutFrameSet::notifyFrameEdgeInfoChanged()
281 { 283 {
282 if (needsLayout()) 284 if (needsLayout())
283 return; 285 return;
284 // FIXME: We should only recompute the edge info with respect to the frame t hat changed 286 // FIXME: We should only recompute the edge info with respect to the frame t hat changed
285 // and its adjacent frame(s) instead of recomputing the edge info for the en tire frameset. 287 // and its adjacent frame(s) instead of recomputing the edge info for the en tire frameset.
286 computeEdgeInfo(); 288 computeEdgeInfo();
287 } 289 }
288 290
289 void RenderFrameSet::fillFromEdgeInfo(const FrameEdgeInfo& edgeInfo, int r, int c) 291 void LayoutFrameSet::fillFromEdgeInfo(const FrameEdgeInfo& edgeInfo, int r, int c)
290 { 292 {
291 if (edgeInfo.allowBorder(LeftFrameEdge)) 293 if (edgeInfo.allowBorder(LeftFrameEdge))
292 m_cols.m_allowBorder[c] = true; 294 m_cols.m_allowBorder[c] = true;
293 if (edgeInfo.allowBorder(RightFrameEdge)) 295 if (edgeInfo.allowBorder(RightFrameEdge))
294 m_cols.m_allowBorder[c + 1] = true; 296 m_cols.m_allowBorder[c + 1] = true;
295 if (edgeInfo.preventResize(LeftFrameEdge)) 297 if (edgeInfo.preventResize(LeftFrameEdge))
296 m_cols.m_preventResize[c] = true; 298 m_cols.m_preventResize[c] = true;
297 if (edgeInfo.preventResize(RightFrameEdge)) 299 if (edgeInfo.preventResize(RightFrameEdge))
298 m_cols.m_preventResize[c + 1] = true; 300 m_cols.m_preventResize[c + 1] = true;
299 301
300 if (edgeInfo.allowBorder(TopFrameEdge)) 302 if (edgeInfo.allowBorder(TopFrameEdge))
301 m_rows.m_allowBorder[r] = true; 303 m_rows.m_allowBorder[r] = true;
302 if (edgeInfo.allowBorder(BottomFrameEdge)) 304 if (edgeInfo.allowBorder(BottomFrameEdge))
303 m_rows.m_allowBorder[r + 1] = true; 305 m_rows.m_allowBorder[r + 1] = true;
304 if (edgeInfo.preventResize(TopFrameEdge)) 306 if (edgeInfo.preventResize(TopFrameEdge))
305 m_rows.m_preventResize[r] = true; 307 m_rows.m_preventResize[r] = true;
306 if (edgeInfo.preventResize(BottomFrameEdge)) 308 if (edgeInfo.preventResize(BottomFrameEdge))
307 m_rows.m_preventResize[r + 1] = true; 309 m_rows.m_preventResize[r + 1] = true;
308 } 310 }
309 311
310 void RenderFrameSet::computeEdgeInfo() 312 void LayoutFrameSet::computeEdgeInfo()
311 { 313 {
312 m_rows.m_preventResize.fill(frameSet()->noResize()); 314 m_rows.m_preventResize.fill(frameSet()->noResize());
313 m_rows.m_allowBorder.fill(false); 315 m_rows.m_allowBorder.fill(false);
314 m_cols.m_preventResize.fill(frameSet()->noResize()); 316 m_cols.m_preventResize.fill(frameSet()->noResize());
315 m_cols.m_allowBorder.fill(false); 317 m_cols.m_allowBorder.fill(false);
316 318
317 LayoutObject* child = firstChild(); 319 LayoutObject* child = firstChild();
318 if (!child) 320 if (!child)
319 return; 321 return;
320 322
321 size_t rows = m_rows.m_sizes.size(); 323 size_t rows = m_rows.m_sizes.size();
322 size_t cols = m_cols.m_sizes.size(); 324 size_t cols = m_cols.m_sizes.size();
323 for (size_t r = 0; r < rows; ++r) { 325 for (size_t r = 0; r < rows; ++r) {
324 for (size_t c = 0; c < cols; ++c) { 326 for (size_t c = 0; c < cols; ++c) {
325 FrameEdgeInfo edgeInfo; 327 FrameEdgeInfo edgeInfo;
326 if (child->isFrameSet()) 328 if (child->isFrameSet())
327 edgeInfo = toRenderFrameSet(child)->edgeInfo(); 329 edgeInfo = toLayoutFrameSet(child)->edgeInfo();
328 else 330 else
329 edgeInfo = toRenderFrame(child)->edgeInfo(); 331 edgeInfo = toLayoutFrame(child)->edgeInfo();
330 fillFromEdgeInfo(edgeInfo, r, c); 332 fillFromEdgeInfo(edgeInfo, r, c);
331 child = child->nextSibling(); 333 child = child->nextSibling();
332 if (!child) 334 if (!child)
333 return; 335 return;
334 } 336 }
335 } 337 }
336 } 338 }
337 339
338 FrameEdgeInfo RenderFrameSet::edgeInfo() const 340 FrameEdgeInfo LayoutFrameSet::edgeInfo() const
339 { 341 {
340 FrameEdgeInfo result(frameSet()->noResize(), true); 342 FrameEdgeInfo result(frameSet()->noResize(), true);
341 343
342 int rows = frameSet()->totalRows(); 344 int rows = frameSet()->totalRows();
343 int cols = frameSet()->totalCols(); 345 int cols = frameSet()->totalCols();
344 if (rows && cols) { 346 if (rows && cols) {
345 result.setPreventResize(LeftFrameEdge, m_cols.m_preventResize[0]); 347 result.setPreventResize(LeftFrameEdge, m_cols.m_preventResize[0]);
346 result.setAllowBorder(LeftFrameEdge, m_cols.m_allowBorder[0]); 348 result.setAllowBorder(LeftFrameEdge, m_cols.m_allowBorder[0]);
347 result.setPreventResize(RightFrameEdge, m_cols.m_preventResize[cols]); 349 result.setPreventResize(RightFrameEdge, m_cols.m_preventResize[cols]);
348 result.setAllowBorder(RightFrameEdge, m_cols.m_allowBorder[cols]); 350 result.setAllowBorder(RightFrameEdge, m_cols.m_allowBorder[cols]);
349 result.setPreventResize(TopFrameEdge, m_rows.m_preventResize[0]); 351 result.setPreventResize(TopFrameEdge, m_rows.m_preventResize[0]);
350 result.setAllowBorder(TopFrameEdge, m_rows.m_allowBorder[0]); 352 result.setAllowBorder(TopFrameEdge, m_rows.m_allowBorder[0]);
351 result.setPreventResize(BottomFrameEdge, m_rows.m_preventResize[rows]); 353 result.setPreventResize(BottomFrameEdge, m_rows.m_preventResize[rows]);
352 result.setAllowBorder(BottomFrameEdge, m_rows.m_allowBorder[rows]); 354 result.setAllowBorder(BottomFrameEdge, m_rows.m_allowBorder[rows]);
353 } 355 }
354 356
355 return result; 357 return result;
356 } 358 }
357 359
358 void RenderFrameSet::layout() 360 void LayoutFrameSet::layout()
359 { 361 {
360 ASSERT(needsLayout()); 362 ASSERT(needsLayout());
361 363
362 if (!parent()->isFrameSet() && !document().printing()) { 364 if (!parent()->isFrameSet() && !document().printing()) {
363 setWidth(view()->viewWidth()); 365 setWidth(view()->viewWidth());
364 setHeight(view()->viewHeight()); 366 setHeight(view()->viewHeight());
365 } 367 }
366 368
367 unsigned cols = frameSet()->totalCols(); 369 unsigned cols = frameSet()->totalCols();
368 unsigned rows = frameSet()->totalRows(); 370 unsigned rows = frameSet()->totalRows();
(...skipping 21 matching lines...) Expand all
390 static void clearNeedsLayoutOnHiddenFrames(RenderBox* frame) 392 static void clearNeedsLayoutOnHiddenFrames(RenderBox* frame)
391 { 393 {
392 for (; frame; frame = frame->nextSiblingBox()) { 394 for (; frame; frame = frame->nextSiblingBox()) {
393 frame->setWidth(0); 395 frame->setWidth(0);
394 frame->setHeight(0); 396 frame->setHeight(0);
395 frame->clearNeedsLayout(); 397 frame->clearNeedsLayout();
396 clearNeedsLayoutOnHiddenFrames(frame->firstChildBox()); 398 clearNeedsLayoutOnHiddenFrames(frame->firstChildBox());
397 } 399 }
398 } 400 }
399 401
400 void RenderFrameSet::positionFrames() 402 void LayoutFrameSet::positionFrames()
401 { 403 {
402 RenderBox* child = firstChildBox(); 404 RenderBox* child = firstChildBox();
403 if (!child) 405 if (!child)
404 return; 406 return;
405 407
406 int rows = frameSet()->totalRows(); 408 int rows = frameSet()->totalRows();
407 int cols = frameSet()->totalCols(); 409 int cols = frameSet()->totalCols();
408 410
409 int borderThickness = frameSet()->border(); 411 int borderThickness = frameSet()->border();
410 LayoutSize size; 412 LayoutSize size;
(...skipping 18 matching lines...) Expand all
429 if (!child) 431 if (!child)
430 return; 432 return;
431 } 433 }
432 position.setY(position.y() + size.height() + borderThickness); 434 position.setY(position.y() + size.height() + borderThickness);
433 } 435 }
434 436
435 // All the remaining frames are hidden to avoid ugly spurious unflowed frame s. 437 // All the remaining frames are hidden to avoid ugly spurious unflowed frame s.
436 clearNeedsLayoutOnHiddenFrames(child); 438 clearNeedsLayoutOnHiddenFrames(child);
437 } 439 }
438 440
439 void RenderFrameSet::startResizing(GridAxis& axis, int position) 441 void LayoutFrameSet::startResizing(GridAxis& axis, int position)
440 { 442 {
441 int split = hitTestSplit(axis, position); 443 int split = hitTestSplit(axis, position);
442 if (split == noSplit || axis.m_preventResize[split]) { 444 if (split == noSplit || axis.m_preventResize[split]) {
443 axis.m_splitBeingResized = noSplit; 445 axis.m_splitBeingResized = noSplit;
444 return; 446 return;
445 } 447 }
446 axis.m_splitBeingResized = split; 448 axis.m_splitBeingResized = split;
447 axis.m_splitResizeOffset = position - splitPosition(axis, split); 449 axis.m_splitResizeOffset = position - splitPosition(axis, split);
448 } 450 }
449 451
450 void RenderFrameSet::continueResizing(GridAxis& axis, int position) 452 void LayoutFrameSet::continueResizing(GridAxis& axis, int position)
451 { 453 {
452 if (needsLayout()) 454 if (needsLayout())
453 return; 455 return;
454 if (axis.m_splitBeingResized == noSplit) 456 if (axis.m_splitBeingResized == noSplit)
455 return; 457 return;
456 int currentSplitPosition = splitPosition(axis, axis.m_splitBeingResized); 458 int currentSplitPosition = splitPosition(axis, axis.m_splitBeingResized);
457 int delta = (position - currentSplitPosition) - axis.m_splitResizeOffset; 459 int delta = (position - currentSplitPosition) - axis.m_splitResizeOffset;
458 if (!delta) 460 if (!delta)
459 return; 461 return;
460 axis.m_deltas[axis.m_splitBeingResized - 1] += delta; 462 axis.m_deltas[axis.m_splitBeingResized - 1] += delta;
461 axis.m_deltas[axis.m_splitBeingResized] -= delta; 463 axis.m_deltas[axis.m_splitBeingResized] -= delta;
462 setNeedsLayoutAndFullPaintInvalidation(); 464 setNeedsLayoutAndFullPaintInvalidation();
463 } 465 }
464 466
465 bool RenderFrameSet::userResize(MouseEvent* evt) 467 bool LayoutFrameSet::userResize(MouseEvent* evt)
466 { 468 {
467 if (!m_isResizing) { 469 if (!m_isResizing) {
468 if (needsLayout()) 470 if (needsLayout())
469 return false; 471 return false;
470 if (evt->type() == EventTypeNames::mousedown && evt->button() == LeftBut ton) { 472 if (evt->type() == EventTypeNames::mousedown && evt->button() == LeftBut ton) {
471 FloatPoint localPos = absoluteToLocal(FloatPoint(evt->absoluteLocati on()), UseTransforms); 473 FloatPoint localPos = absoluteToLocal(FloatPoint(evt->absoluteLocati on()), UseTransforms);
472 startResizing(m_cols, localPos.x()); 474 startResizing(m_cols, localPos.x());
473 startResizing(m_rows, localPos.y()); 475 startResizing(m_rows, localPos.y());
474 if (m_cols.m_splitBeingResized != noSplit || m_rows.m_splitBeingResi zed != noSplit) { 476 if (m_cols.m_splitBeingResized != noSplit || m_rows.m_splitBeingResi zed != noSplit) {
475 setIsResizing(true); 477 setIsResizing(true);
476 return true; 478 return true;
477 } 479 }
478 } 480 }
479 } else { 481 } else {
480 if (evt->type() == EventTypeNames::mousemove || (evt->type() == EventTyp eNames::mouseup && evt->button() == LeftButton)) { 482 if (evt->type() == EventTypeNames::mousemove || (evt->type() == EventTyp eNames::mouseup && evt->button() == LeftButton)) {
481 FloatPoint localPos = absoluteToLocal(FloatPoint(evt->absoluteLocati on()), UseTransforms); 483 FloatPoint localPos = absoluteToLocal(FloatPoint(evt->absoluteLocati on()), UseTransforms);
482 continueResizing(m_cols, localPos.x()); 484 continueResizing(m_cols, localPos.x());
483 continueResizing(m_rows, localPos.y()); 485 continueResizing(m_rows, localPos.y());
484 if (evt->type() == EventTypeNames::mouseup && evt->button() == LeftB utton) { 486 if (evt->type() == EventTypeNames::mouseup && evt->button() == LeftB utton) {
485 setIsResizing(false); 487 setIsResizing(false);
486 return true; 488 return true;
487 } 489 }
488 } 490 }
489 } 491 }
490 492
491 return false; 493 return false;
492 } 494 }
493 495
494 void RenderFrameSet::setIsResizing(bool isResizing) 496 void LayoutFrameSet::setIsResizing(bool isResizing)
495 { 497 {
496 m_isResizing = isResizing; 498 m_isResizing = isResizing;
497 for (LayoutObject* ancestor = parent(); ancestor; ancestor = ancestor->paren t()) { 499 for (LayoutObject* ancestor = parent(); ancestor; ancestor = ancestor->paren t()) {
498 if (ancestor->isFrameSet()) 500 if (ancestor->isFrameSet())
499 toRenderFrameSet(ancestor)->m_isChildResizing = isResizing; 501 toLayoutFrameSet(ancestor)->m_isChildResizing = isResizing;
500 } 502 }
501 if (LocalFrame* frame = this->frame()) 503 if (LocalFrame* frame = this->frame())
502 frame->eventHandler().setResizingFrameSet(isResizing ? frameSet() : 0); 504 frame->eventHandler().setResizingFrameSet(isResizing ? frameSet() : 0);
503 } 505 }
504 506
505 bool RenderFrameSet::canResizeRow(const IntPoint& p) const 507 bool LayoutFrameSet::canResizeRow(const IntPoint& p) const
506 { 508 {
507 int r = hitTestSplit(m_rows, p.y()); 509 int r = hitTestSplit(m_rows, p.y());
508 return r != noSplit && !m_rows.m_preventResize[r]; 510 return r != noSplit && !m_rows.m_preventResize[r];
509 } 511 }
510 512
511 bool RenderFrameSet::canResizeColumn(const IntPoint& p) const 513 bool LayoutFrameSet::canResizeColumn(const IntPoint& p) const
512 { 514 {
513 int c = hitTestSplit(m_cols, p.x()); 515 int c = hitTestSplit(m_cols, p.x());
514 return c != noSplit && !m_cols.m_preventResize[c]; 516 return c != noSplit && !m_cols.m_preventResize[c];
515 } 517 }
516 518
517 int RenderFrameSet::splitPosition(const GridAxis& axis, int split) const 519 int LayoutFrameSet::splitPosition(const GridAxis& axis, int split) const
518 { 520 {
519 if (needsLayout()) 521 if (needsLayout())
520 return 0; 522 return 0;
521 523
522 int borderThickness = frameSet()->border(); 524 int borderThickness = frameSet()->border();
523 525
524 int size = axis.m_sizes.size(); 526 int size = axis.m_sizes.size();
525 if (!size) 527 if (!size)
526 return 0; 528 return 0;
527 529
528 int position = 0; 530 int position = 0;
529 for (int i = 0; i < split && i < size; ++i) 531 for (int i = 0; i < split && i < size; ++i)
530 position += axis.m_sizes[i] + borderThickness; 532 position += axis.m_sizes[i] + borderThickness;
531 return position - borderThickness; 533 return position - borderThickness;
532 } 534 }
533 535
534 int RenderFrameSet::hitTestSplit(const GridAxis& axis, int position) const 536 int LayoutFrameSet::hitTestSplit(const GridAxis& axis, int position) const
535 { 537 {
536 if (needsLayout()) 538 if (needsLayout())
537 return noSplit; 539 return noSplit;
538 540
539 int borderThickness = frameSet()->border(); 541 int borderThickness = frameSet()->border();
540 if (borderThickness <= 0) 542 if (borderThickness <= 0)
541 return noSplit; 543 return noSplit;
542 544
543 size_t size = axis.m_sizes.size(); 545 size_t size = axis.m_sizes.size();
544 if (!size) 546 if (!size)
545 return noSplit; 547 return noSplit;
546 548
547 int splitPosition = axis.m_sizes[0]; 549 int splitPosition = axis.m_sizes[0];
548 for (size_t i = 1; i < size; ++i) { 550 for (size_t i = 1; i < size; ++i) {
549 if (position >= splitPosition && position < splitPosition + borderThickn ess) 551 if (position >= splitPosition && position < splitPosition + borderThickn ess)
550 return i; 552 return i;
551 splitPosition += borderThickness + axis.m_sizes[i]; 553 splitPosition += borderThickness + axis.m_sizes[i];
552 } 554 }
553 return noSplit; 555 return noSplit;
554 } 556 }
555 557
556 bool RenderFrameSet::isChildAllowed(LayoutObject* child, const LayoutStyle&) con st 558 bool LayoutFrameSet::isChildAllowed(LayoutObject* child, const LayoutStyle&) con st
557 { 559 {
558 return child->isFrame() || child->isFrameSet(); 560 return child->isFrame() || child->isFrameSet();
559 } 561 }
560 562
561 CursorDirective RenderFrameSet::getCursor(const LayoutPoint& point, Cursor& curs or) const 563 CursorDirective LayoutFrameSet::getCursor(const LayoutPoint& point, Cursor& curs or) const
562 { 564 {
563 IntPoint roundedPoint = roundedIntPoint(point); 565 IntPoint roundedPoint = roundedIntPoint(point);
564 if (canResizeRow(roundedPoint)) { 566 if (canResizeRow(roundedPoint)) {
565 cursor = rowResizeCursor(); 567 cursor = rowResizeCursor();
566 return SetCursor; 568 return SetCursor;
567 } 569 }
568 if (canResizeColumn(roundedPoint)) { 570 if (canResizeColumn(roundedPoint)) {
569 cursor = columnResizeCursor(); 571 cursor = columnResizeCursor();
570 return SetCursor; 572 return SetCursor;
571 } 573 }
572 return RenderBox::getCursor(point, cursor); 574 return RenderBox::getCursor(point, cursor);
573 } 575 }
574 576
575 } // namespace blink 577 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutFrameSet.h ('k') | Source/core/layout/LayoutPart.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698