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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLTableElement.cpp

Issue 2694283003: Annotate ScriptWrappable-embedding singletons.
Patch Set: add XPathValue singleton Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org) 3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org) 4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org) 5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010, 2011 Apple Inc. All rights 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010, 2011 Apple Inc. All rights
8 * reserved. 8 * reserved.
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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 } else { 427 } else {
428 HTMLElement::parseAttribute(params); 428 HTMLElement::parseAttribute(params);
429 } 429 }
430 430
431 if (bordersBefore != getCellBorders() || oldPadding != m_padding) { 431 if (bordersBefore != getCellBorders() || oldPadding != m_padding) {
432 m_sharedCellStyle = nullptr; 432 m_sharedCellStyle = nullptr;
433 setNeedsTableStyleRecalc(); 433 setNeedsTableStyleRecalc();
434 } 434 }
435 } 435 }
436 436
437 static StylePropertySet* createBorderStyle(CSSValueID value) { 437 static MutableStylePropertySet* createBorderStyle(CSSValueID value) {
438 MutableStylePropertySet* style = 438 MutableStylePropertySet* style =
439 MutableStylePropertySet::create(HTMLQuirksMode); 439 MutableStylePropertySet::create(HTMLQuirksMode);
440 style->setProperty(CSSPropertyBorderTopStyle, value); 440 style->setProperty(CSSPropertyBorderTopStyle, value);
441 style->setProperty(CSSPropertyBorderBottomStyle, value); 441 style->setProperty(CSSPropertyBorderBottomStyle, value);
442 style->setProperty(CSSPropertyBorderLeftStyle, value); 442 style->setProperty(CSSPropertyBorderLeftStyle, value);
443 style->setProperty(CSSPropertyBorderRightStyle, value); 443 style->setProperty(CSSPropertyBorderRightStyle, value);
444 return style; 444 return style;
445 } 445 }
446 446
447 const StylePropertySet* 447 const StylePropertySet*
448 HTMLTableElement::additionalPresentationAttributeStyle() { 448 HTMLTableElement::additionalPresentationAttributeStyle() {
449 if (m_frameAttr) 449 if (m_frameAttr)
450 return nullptr; 450 return nullptr;
451 451
452 if (!m_borderAttr && !m_borderColorAttr) { 452 if (!m_borderAttr && !m_borderColorAttr) {
453 // Setting the border to 'hidden' allows it to win over any border 453 // Setting the border to 'hidden' allows it to win over any border
454 // set on the table's cells during border-conflict resolution. 454 // set on the table's cells during border-conflict resolution.
455 if (m_rulesAttr != UnsetRules) { 455 if (m_rulesAttr != UnsetRules) {
456 DEFINE_STATIC_LOCAL(StylePropertySet, solidBorderStyle, 456 ALLOW_UNSAFE_SINGLETON()
457 DEFINE_STATIC_LOCAL(MutableStylePropertySet, solidBorderStyle,
457 (createBorderStyle(CSSValueHidden))); 458 (createBorderStyle(CSSValueHidden)));
458 return &solidBorderStyle; 459 return &solidBorderStyle;
459 } 460 }
460 return nullptr; 461 return nullptr;
461 } 462 }
462 463
463 if (m_borderColorAttr) { 464 if (m_borderColorAttr) {
464 DEFINE_STATIC_LOCAL(StylePropertySet, solidBorderStyle, 465 ALLOW_UNSAFE_SINGLETON()
466 DEFINE_STATIC_LOCAL(MutableStylePropertySet, solidBorderStyle,
465 (createBorderStyle(CSSValueSolid))); 467 (createBorderStyle(CSSValueSolid)));
466 return &solidBorderStyle; 468 return &solidBorderStyle;
467 } 469 }
468 DEFINE_STATIC_LOCAL(StylePropertySet, outsetBorderStyle, 470 ALLOW_UNSAFE_SINGLETON()
471 DEFINE_STATIC_LOCAL(MutableStylePropertySet, outsetBorderStyle,
469 (createBorderStyle(CSSValueOutset))); 472 (createBorderStyle(CSSValueOutset)));
470 return &outsetBorderStyle; 473 return &outsetBorderStyle;
471 } 474 }
472 475
473 HTMLTableElement::CellBorders HTMLTableElement::getCellBorders() const { 476 HTMLTableElement::CellBorders HTMLTableElement::getCellBorders() const {
474 switch (m_rulesAttr) { 477 switch (m_rulesAttr) {
475 case NoneRules: 478 case NoneRules:
476 case GroupsRules: 479 case GroupsRules:
477 return NoBorders; 480 return NoBorders;
478 case AllRules: 481 case AllRules:
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 543
541 return style; 544 return style;
542 } 545 }
543 546
544 const StylePropertySet* HTMLTableElement::additionalCellStyle() { 547 const StylePropertySet* HTMLTableElement::additionalCellStyle() {
545 if (!m_sharedCellStyle) 548 if (!m_sharedCellStyle)
546 m_sharedCellStyle = createSharedCellStyle(); 549 m_sharedCellStyle = createSharedCellStyle();
547 return m_sharedCellStyle.get(); 550 return m_sharedCellStyle.get();
548 } 551 }
549 552
550 static StylePropertySet* createGroupBorderStyle(int rows) { 553 static MutableStylePropertySet* createGroupBorderStyle(int rows) {
551 MutableStylePropertySet* style = 554 MutableStylePropertySet* style =
552 MutableStylePropertySet::create(HTMLQuirksMode); 555 MutableStylePropertySet::create(HTMLQuirksMode);
553 if (rows) { 556 if (rows) {
554 style->setProperty(CSSPropertyBorderTopWidth, CSSValueThin); 557 style->setProperty(CSSPropertyBorderTopWidth, CSSValueThin);
555 style->setProperty(CSSPropertyBorderBottomWidth, CSSValueThin); 558 style->setProperty(CSSPropertyBorderBottomWidth, CSSValueThin);
556 style->setProperty(CSSPropertyBorderTopStyle, CSSValueSolid); 559 style->setProperty(CSSPropertyBorderTopStyle, CSSValueSolid);
557 style->setProperty(CSSPropertyBorderBottomStyle, CSSValueSolid); 560 style->setProperty(CSSPropertyBorderBottomStyle, CSSValueSolid);
558 } else { 561 } else {
559 style->setProperty(CSSPropertyBorderLeftWidth, CSSValueThin); 562 style->setProperty(CSSPropertyBorderLeftWidth, CSSValueThin);
560 style->setProperty(CSSPropertyBorderRightWidth, CSSValueThin); 563 style->setProperty(CSSPropertyBorderRightWidth, CSSValueThin);
561 style->setProperty(CSSPropertyBorderLeftStyle, CSSValueSolid); 564 style->setProperty(CSSPropertyBorderLeftStyle, CSSValueSolid);
562 style->setProperty(CSSPropertyBorderRightStyle, CSSValueSolid); 565 style->setProperty(CSSPropertyBorderRightStyle, CSSValueSolid);
563 } 566 }
564 return style; 567 return style;
565 } 568 }
566 569
567 const StylePropertySet* HTMLTableElement::additionalGroupStyle(bool rows) { 570 const StylePropertySet* HTMLTableElement::additionalGroupStyle(bool rows) {
568 if (m_rulesAttr != GroupsRules) 571 if (m_rulesAttr != GroupsRules)
569 return nullptr; 572 return nullptr;
570 573
571 if (rows) { 574 if (rows) {
572 DEFINE_STATIC_LOCAL(StylePropertySet, rowBorderStyle, 575 ALLOW_UNSAFE_SINGLETON()
576 DEFINE_STATIC_LOCAL(MutableStylePropertySet, rowBorderStyle,
573 (createGroupBorderStyle(true))); 577 (createGroupBorderStyle(true)));
574 return &rowBorderStyle; 578 return &rowBorderStyle;
575 } 579 }
576 DEFINE_STATIC_LOCAL(StylePropertySet, columnBorderStyle, 580 ALLOW_UNSAFE_SINGLETON()
581 DEFINE_STATIC_LOCAL(MutableStylePropertySet, columnBorderStyle,
577 (createGroupBorderStyle(false))); 582 (createGroupBorderStyle(false)));
578 return &columnBorderStyle; 583 return &columnBorderStyle;
579 } 584 }
580 585
581 bool HTMLTableElement::isURLAttribute(const Attribute& attribute) const { 586 bool HTMLTableElement::isURLAttribute(const Attribute& attribute) const {
582 return attribute.name() == backgroundAttr || 587 return attribute.name() == backgroundAttr ||
583 HTMLElement::isURLAttribute(attribute); 588 HTMLElement::isURLAttribute(attribute);
584 } 589 }
585 590
586 bool HTMLTableElement::hasLegalLinkAttribute(const QualifiedName& name) const { 591 bool HTMLTableElement::hasLegalLinkAttribute(const QualifiedName& name) const {
(...skipping 19 matching lines...) Expand all
606 const AtomicString& HTMLTableElement::summary() const { 611 const AtomicString& HTMLTableElement::summary() const {
607 return getAttribute(summaryAttr); 612 return getAttribute(summaryAttr);
608 } 613 }
609 614
610 DEFINE_TRACE(HTMLTableElement) { 615 DEFINE_TRACE(HTMLTableElement) {
611 visitor->trace(m_sharedCellStyle); 616 visitor->trace(m_sharedCellStyle);
612 HTMLElement::trace(visitor); 617 HTMLElement::trace(visitor);
613 } 618 }
614 619
615 } // namespace blink 620 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutTestHelper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698