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

Side by Side Diff: sky/engine/core/dom/Element.cpp

Issue 879993004: Remove ScrollableArea and Scrollbar (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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/engine/core/dom/Document.cpp ('k') | sky/engine/core/editing/EditorCommand.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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 #include "sky/engine/core/html/HTMLElement.h" 73 #include "sky/engine/core/html/HTMLElement.h"
74 #include "sky/engine/core/html/HTMLTemplateElement.h" 74 #include "sky/engine/core/html/HTMLTemplateElement.h"
75 #include "sky/engine/core/html/parser/HTMLDocumentParser.h" 75 #include "sky/engine/core/html/parser/HTMLDocumentParser.h"
76 #include "sky/engine/core/html/parser/HTMLParserIdioms.h" 76 #include "sky/engine/core/html/parser/HTMLParserIdioms.h"
77 #include "sky/engine/core/page/ChromeClient.h" 77 #include "sky/engine/core/page/ChromeClient.h"
78 #include "sky/engine/core/page/FocusController.h" 78 #include "sky/engine/core/page/FocusController.h"
79 #include "sky/engine/core/page/Page.h" 79 #include "sky/engine/core/page/Page.h"
80 #include "sky/engine/core/rendering/RenderLayer.h" 80 #include "sky/engine/core/rendering/RenderLayer.h"
81 #include "sky/engine/core/rendering/RenderView.h" 81 #include "sky/engine/core/rendering/RenderView.h"
82 #include "sky/engine/platform/EventDispatchForbiddenScope.h" 82 #include "sky/engine/platform/EventDispatchForbiddenScope.h"
83 #include "sky/engine/platform/scroll/ScrollableArea.h"
84 #include "sky/engine/wtf/BitVector.h" 83 #include "sky/engine/wtf/BitVector.h"
85 #include "sky/engine/wtf/HashFunctions.h" 84 #include "sky/engine/wtf/HashFunctions.h"
86 #include "sky/engine/wtf/text/CString.h" 85 #include "sky/engine/wtf/text/CString.h"
87 #include "sky/engine/wtf/text/StringBuilder.h" 86 #include "sky/engine/wtf/text/StringBuilder.h"
88 #include "sky/engine/wtf/text/TextPosition.h" 87 #include "sky/engine/wtf/text/TextPosition.h"
89 88
90 namespace blink { 89 namespace blink {
91 90
92 PassRefPtr<Element> Element::create(const QualifiedName& tagName, Document* docu ment) 91 PassRefPtr<Element> Element::create(const QualifiedName& tagName, Document* docu ment)
93 { 92 {
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 return view->layoutSize().height(); 393 return view->layoutSize().height();
395 } 394 }
396 395
397 if (RenderBox* renderer = renderBox()) 396 if (RenderBox* renderer = renderBox())
398 return renderer->pixelSnappedClientHeight(); 397 return renderer->pixelSnappedClientHeight();
399 return 0; 398 return 0;
400 } 399 }
401 400
402 int Element::scrollLeft() 401 int Element::scrollLeft()
403 { 402 {
404 document().updateLayout(); 403 // FIXME(sky): Remove(scrolling)
405
406 if (document().documentElement() != this) {
407 if (RenderBox* rend = renderBox())
408 return rend->scrollLeft();
409 }
410
411 return 0; 404 return 0;
412 } 405 }
413 406
414 int Element::scrollTop() 407 int Element::scrollTop()
415 { 408 {
416 document().updateLayout(); 409 // FIXME(sky): Remove(scrolling)
417
418 if (document().documentElement() != this) {
419 if (RenderBox* rend = renderBox())
420 return rend->scrollTop();
421 }
422
423 return 0; 410 return 0;
424 } 411 }
425 412
426 void Element::setScrollLeft(int newLeft) 413 void Element::setScrollLeft(int newLeft)
427 { 414 {
428 document().updateLayout(); 415 // FIXME(sky): Remove(scrolling)
429
430 if (document().documentElement() != this) {
431 if (RenderBox* rend = renderBox())
432 rend->setScrollLeft(newLeft);
433 }
434 } 416 }
435 417
436 void Element::setScrollLeft(const Dictionary& scrollOptionsHorizontal, Exception State& exceptionState) 418 void Element::setScrollLeft(const Dictionary& scrollOptionsHorizontal, Exception State& exceptionState)
437 { 419 {
438 String scrollBehaviorString; 420 // FIXME(sky): Remove(scrolling)
439 ScrollBehavior scrollBehavior = ScrollBehaviorAuto;
440 if (DictionaryHelper::get(scrollOptionsHorizontal, "behavior", scrollBehavio rString)) {
441 if (!ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scro llBehavior)) {
442 exceptionState.throwTypeError("The ScrollBehavior provided is invali d.");
443 return;
444 }
445 }
446
447 int position;
448 if (!DictionaryHelper::get(scrollOptionsHorizontal, "x", position)) {
449 exceptionState.throwTypeError("ScrollOptionsHorizontal must include an ' x' member.");
450 return;
451 }
452
453 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant ly.
454 setScrollLeft(position);
455 } 421 }
456 422
457 void Element::setScrollTop(int newTop) 423 void Element::setScrollTop(int newTop)
458 { 424 {
459 document().updateLayout(); 425 // FIXME(sky): Remove(scrolling)
460
461 if (document().documentElement() != this) {
462 if (RenderBox* rend = renderBox())
463 rend->setScrollTop(newTop);
464 }
465 } 426 }
466 427
467 void Element::setScrollTop(const Dictionary& scrollOptionsVertical, ExceptionSta te& exceptionState) 428 void Element::setScrollTop(const Dictionary& scrollOptionsVertical, ExceptionSta te& exceptionState)
468 { 429 {
469 String scrollBehaviorString; 430 // FIXME(sky): Remove(scrolling)
470 ScrollBehavior scrollBehavior = ScrollBehaviorAuto;
471 if (DictionaryHelper::get(scrollOptionsVertical, "behavior", scrollBehaviorS tring)) {
472 if (!ScrollableArea::scrollBehaviorFromString(scrollBehaviorString, scro llBehavior)) {
473 exceptionState.throwTypeError("The ScrollBehavior provided is invali d.");
474 return;
475 }
476 }
477
478 int position;
479 if (!DictionaryHelper::get(scrollOptionsVertical, "y", position)) {
480 exceptionState.throwTypeError("ScrollOptionsVertical must include a 'y' member.");
481 return;
482 }
483
484 // FIXME: Use scrollBehavior to decide whether to scroll smoothly or instant ly.
485 setScrollTop(position);
486 } 431 }
487 432
488 int Element::scrollWidth() 433 int Element::scrollWidth()
489 { 434 {
490 document().updateLayout(); 435 // FIXME(sky): Remove(scrolling)
491 if (RenderBox* rend = renderBox())
492 return rend->scrollWidth().toDouble();
493 return 0; 436 return 0;
494 } 437 }
495 438
496 int Element::scrollHeight() 439 int Element::scrollHeight()
497 { 440 {
498 document().updateLayout(); 441 // FIXME(sky): Remove(scrolling)
499 if (RenderBox* rend = renderBox())
500 return rend->scrollHeight().toDouble();
501 return 0; 442 return 0;
502 } 443 }
503 444
504 PassRefPtr<ClientRectList> Element::getClientRects() 445 PassRefPtr<ClientRectList> Element::getClientRects()
505 { 446 {
506 document().updateLayout(); 447 document().updateLayout();
507 448
508 RenderBoxModelObject* renderBoxModelObject = this->renderBoxModelObject(); 449 RenderBoxModelObject* renderBoxModelObject = this->renderBoxModelObject();
509 if (!renderBoxModelObject) 450 if (!renderBoxModelObject)
510 return ClientRectList::create(); 451 return ClientRectList::create();
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1707 return false; 1648 return false;
1708 if (treeScope().scopedStyleResolver().hasSelectorForId(idValue)) 1649 if (treeScope().scopedStyleResolver().hasSelectorForId(idValue))
1709 return true; 1650 return true;
1710 // Host rules could also have effects. 1651 // Host rules could also have effects.
1711 if (ShadowRoot* shadowRoot = this->shadowRoot()) 1652 if (ShadowRoot* shadowRoot = this->shadowRoot())
1712 return shadowRoot->scopedStyleResolver().hasSelectorForId(idValue); 1653 return shadowRoot->scopedStyleResolver().hasSelectorForId(idValue);
1713 return false; 1654 return false;
1714 } 1655 }
1715 1656
1716 } // namespace blink 1657 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/dom/Document.cpp ('k') | sky/engine/core/editing/EditorCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698