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

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

Issue 2680843006: Tidy DEFINE_(THREAD_SAFE_)STATIC_LOCAL() implementations. (Closed)
Patch Set: explain safety of HTMLTableSectionElement singletons 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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Note: this (Mutable)StylePropertySet singleton has an embedded
457 // CSSStyleDeclaration reference (m_cssomWrapper), which is a
458 // ScriptWrappable (=> it can have a v8 wrapper object). Exposing
459 // and sharing those via static locals is unsafe, as the singleton
460 // really is accessible across window contexts within a renderer
461 // process.
462 //
463 // However, that CSSStyleDeclaration is never instantiated for these
464 // presentation attribute style properties, hence this singleton (and
465 // the ones below) are considered safe. Indicate that by disabling
466 // the no-ScriptWrappables-in-singletons verification check.
haraken 2017/02/11 10:25:20 Your analysis looks correct, but it looks better t
sof 2017/02/11 12:09:11 That could probably be done without it being too a
456 DEFINE_STATIC_LOCAL(StylePropertySet, solidBorderStyle, 467 DEFINE_STATIC_LOCAL(StylePropertySet, solidBorderStyle,
457 (createBorderStyle(CSSValueHidden))); 468 (createBorderStyle(CSSValueHidden)),
469 CheckScriptWrappable::No);
458 return &solidBorderStyle; 470 return &solidBorderStyle;
459 } 471 }
460 return nullptr; 472 return nullptr;
461 } 473 }
462 474
463 if (m_borderColorAttr) { 475 if (m_borderColorAttr) {
464 DEFINE_STATIC_LOCAL(StylePropertySet, solidBorderStyle, 476 DEFINE_STATIC_LOCAL(StylePropertySet, solidBorderStyle,
465 (createBorderStyle(CSSValueSolid))); 477 (createBorderStyle(CSSValueSolid)),
478 CheckScriptWrappable::No);
466 return &solidBorderStyle; 479 return &solidBorderStyle;
467 } 480 }
468 DEFINE_STATIC_LOCAL(StylePropertySet, outsetBorderStyle, 481 DEFINE_STATIC_LOCAL(StylePropertySet, outsetBorderStyle,
469 (createBorderStyle(CSSValueOutset))); 482 (createBorderStyle(CSSValueOutset)),
483 CheckScriptWrappable::No);
470 return &outsetBorderStyle; 484 return &outsetBorderStyle;
471 } 485 }
472 486
473 HTMLTableElement::CellBorders HTMLTableElement::getCellBorders() const { 487 HTMLTableElement::CellBorders HTMLTableElement::getCellBorders() const {
474 switch (m_rulesAttr) { 488 switch (m_rulesAttr) {
475 case NoneRules: 489 case NoneRules:
476 case GroupsRules: 490 case GroupsRules:
477 return NoBorders; 491 return NoBorders;
478 case AllRules: 492 case AllRules:
479 return SolidBorders; 493 return SolidBorders;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 } 577 }
564 return style; 578 return style;
565 } 579 }
566 580
567 const StylePropertySet* HTMLTableElement::additionalGroupStyle(bool rows) { 581 const StylePropertySet* HTMLTableElement::additionalGroupStyle(bool rows) {
568 if (m_rulesAttr != GroupsRules) 582 if (m_rulesAttr != GroupsRules)
569 return nullptr; 583 return nullptr;
570 584
571 if (rows) { 585 if (rows) {
572 DEFINE_STATIC_LOCAL(StylePropertySet, rowBorderStyle, 586 DEFINE_STATIC_LOCAL(StylePropertySet, rowBorderStyle,
573 (createGroupBorderStyle(true))); 587 (createGroupBorderStyle(true)),
588 CheckScriptWrappable::No);
574 return &rowBorderStyle; 589 return &rowBorderStyle;
575 } 590 }
576 DEFINE_STATIC_LOCAL(StylePropertySet, columnBorderStyle, 591 DEFINE_STATIC_LOCAL(StylePropertySet, columnBorderStyle,
577 (createGroupBorderStyle(false))); 592 (createGroupBorderStyle(false)),
593 CheckScriptWrappable::No);
578 return &columnBorderStyle; 594 return &columnBorderStyle;
579 } 595 }
580 596
581 bool HTMLTableElement::isURLAttribute(const Attribute& attribute) const { 597 bool HTMLTableElement::isURLAttribute(const Attribute& attribute) const {
582 return attribute.name() == backgroundAttr || 598 return attribute.name() == backgroundAttr ||
583 HTMLElement::isURLAttribute(attribute); 599 HTMLElement::isURLAttribute(attribute);
584 } 600 }
585 601
586 bool HTMLTableElement::hasLegalLinkAttribute(const QualifiedName& name) const { 602 bool HTMLTableElement::hasLegalLinkAttribute(const QualifiedName& name) const {
587 return name == backgroundAttr || HTMLElement::hasLegalLinkAttribute(name); 603 return name == backgroundAttr || HTMLElement::hasLegalLinkAttribute(name);
(...skipping 18 matching lines...) Expand all
606 const AtomicString& HTMLTableElement::summary() const { 622 const AtomicString& HTMLTableElement::summary() const {
607 return getAttribute(summaryAttr); 623 return getAttribute(summaryAttr);
608 } 624 }
609 625
610 DEFINE_TRACE(HTMLTableElement) { 626 DEFINE_TRACE(HTMLTableElement) {
611 visitor->trace(m_sharedCellStyle); 627 visitor->trace(m_sharedCellStyle);
612 HTMLElement::trace(visitor); 628 HTMLElement::trace(visitor);
613 } 629 }
614 630
615 } // namespace blink 631 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698